我已经更改了 spring-boot-dependency-1.2.7.RELEASE.pom 文件中的版本,但我得到 this错误。我已经更新了这两个标签
<thymeleaf.version>3.0.0.ALPHA03</thymeleaf.version>
<thymeleaf-layout-dialect.version>1.3.1</thymeleaf-layout-dialect.version>
最佳答案
您发布该文章已经有一段时间了,但希望这对其他人有帮助。截至目前 Springboot 无法自动配置 Thymeleaf 3.0。您将需要排除 ThymeleafAutoConfiguration 类并提供您的自定义配置。您可以在以下网址中引用有详细记录的步骤:
https://gist.github.com/seanhinkley/6eab2130ceea857c160b
布局方言不由 Thymeleaf 团队管理,它仍然是一个悬而未决的问题。
https://github.com/ultraq/thymeleaf-layout-dialect/issues/68
另一个选择是等到 Springboot 正式支持 Thymeleaf 3.0。
更新:
Springboot 在 1.4.x 版本中添加了对 Thymeleaf 3.0 自动配置的支持。默认情况下,Springboot 仍然使用 Thymeleaf 2.1,但可以将其配置为使用 3.0。
<properties>
<thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>2.1.1</thymeleaf-layout-dialect.version>
</properties>
引用官方文档:
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-use-thymeleaf-3
引用示例:
关于spring - 如何使用 Spring Boot 更新 ThymeLeaf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33483359/