如何使用 Spring Boot 更新 ThymeLeaf

How to update ThymeLeaf using Spring Boot

我已经更改了 spring-boot-dependencies-1.2.7.RELEASE.pom 文件中的版本,但是我得到 this error.I 已经更新了这两个标签

<thymeleaf.version>3.0.0.ALPHA03</thymeleaf.version>
<thymeleaf-layout-dialect.version>1.3.1</thymeleaf-layout-dialect.version>

您已经发布了一段时间,但希望这对 others.As 现在 Springboot 无法自动配置 Thymeleaf 3.0 有所帮助。您需要排除 ThymeleafAutoConfiguration class 并提供您的自定义配置。您可以参考以下 url:

中的详细记录步骤

https://gist.github.com/seanhinkley/6eab2130ceea857c160b

Layout Dialect 不是由 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

样本参考:

https://github.com/spring-projects/spring-boot/tree/v1.5.6.RELEASE/spring-boot-samples/spring-boot-sample-web-thymeleaf3