LoginSignup
5
3

More than 5 years have passed since last update.

Spring BootでThymeleafの構文チェックを緩くする

Posted at

概要

Spring Boot 1.4で使用されるデフォルトのThymeleafはバージョンが2系である。これは、テンプレートをXMLとしてパースするため、閉じタグが必須であるなど、かなり厳密に記述する必要がある。
一般的なHTML5の構文で記述したい場合は、Thymeleafを3系にすることで対応することができる。

Thymeleaf 3系にする

build.gradleでthymeleaf.versionに3系のバージョンを設定する。

dependencies {
    compile('org.springframework.boot:spring-boot-starter-thymeleaf')
    // 略
}

ext['thymeleaf.version'] = '3.0.3.RELEASE'
ext['thymeleaf-layout-dialect.version'] = '2.1.2'
ext['thymeleaf-extras-java8time.version'] = '3.0.0.RELEASE'
ext['thymeleaf-extras-data-attribute.version'] = '2.0.1'

他のオプションは必要に応じて設定する。

関連URL

5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3