spring - 如何使用 Spring Boot 更新 ThymeLeaf

标签 spring maven thymeleaf

我已经更改了 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

引用示例:

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

关于spring - 如何使用 Spring Boot 更新 ThymeLeaf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33483359/

相关文章:

java - maven 和 spring 应用程序部署错误 : Unable to locate NamespaceHandler for namespace [http://www. springframework.org/schema/context]

不包括 Spring Batch 默认 bean

java - Spring - 带有 AbstractWizardFormController 的多个命令类

java - 从 Spring Boot Rest 服务下载文件

java.lang.NoSuchMethodError : org. jboss.logging.Logger.debugf(Ljava/lang/String;I)V WebLogic部署

java - Maven:访问资源

maven - 如何在一个地方为许多 gradle 项目声明依赖版本

java - Thymeleaf 和 Spring : avoid duplicating REST requests for storage into Thymeleaf model class

thymeleaf - 如何在 thymeleaf 中设置全局变量?

java - 如何在 thymeleaf 中使用列表来使用输入类型?