在SpringBoot里面使用Thymeleaf3
最近在一个springboot项目里使用thymeleaf模板,访问页面时一直报错。而之前的项目中没发现过这种情况发生。
和之前的项目对比发现,在springboot项目中引入
1 | <dependency> |
引入的thymeleaf版本居然是2.x.x版本,之前项目引入的是3.x.x版本的

查看相应的pom文件发现,thymeleaf.version确实是2.x.x的。
究竟怎么回事呢?搜索springboot文档中相关thymeleaf的段落,发现了如下描述:
原来在spring-boot-starter-thymeleaf中默认引入的版本thymeleaf是2.1,如果需要使用thymeleaf3,需要在pom.xml中加入如下配置:
1 | <properties> |
如果觉得我的文章对您有帮助,请随意打赏。


