spring boot 使用 thymeleaf 3 时 build.gradle 依赖配置

开发环境

  • spring boot 1.5.9
  • jdk 8
  • thymeleaf 3

问题描述

近日有需求要使用 thymeleaf 3做后台页面开发,默认使用spring-boot-starter-thymeleaf这个starter引入的 thymeleaf 版本为2,需要手工更换为 thymeleaf 3的依赖,只添加thymeleaf 3依赖无法启动服务,经过查询资料后尝试,得出如下配置:

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')
    //... 其它依赖
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。