開發(fā)環(huán)境
- spring boot 1.5.9
- jdk 8
- thymeleaf 3
問題描述
近日有需求要使用 thymeleaf 3做后臺頁面開發(fā),默認(rèn)使用spring-boot-starter-thymeleaf這個starter引入的 thymeleaf 版本為2,需要手工更換為 thymeleaf 3的依賴,只添加thymeleaf 3依賴無法啟動服務(wù),經(jīng)過查詢資料后嘗試,得出如下配置:
build.gradle 中依賴配置如下
dependencies {
//... 其它依賴
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
compile('org.thymeleaf:thymeleaf:3.0.9.RELEASE')
compile('org.thymeleaf:thymeleaf-spring4:3.0.9.RELEASE')
compile('nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:2.2.2')
//... 其它依賴
}