ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
# 71.10 使用Thymeleaf 3 默认情况下,`spring-boot-starter-thymeleaf`使用的是Thymeleaf 2.1,你可以通过覆盖`thymeleaf.version`和`thymeleaf-layout-dialect.version`属性使用Thymeleaf 3,例如: ```text <properties> <thymeleaf.version>3.0.0.RELEASE</thymeleaf.version> <thymeleaf-layout-dialect.version>2.0.0</thymeleaf-layout-dialect.version> </dependency> ``` 为了避免关于HTML 5模板模式过期,将使用HTML模板模式的警告提醒,你需要显式配置`spring.thymeleaf.mode`为`HTML`,例如: ```text spring.thymeleaf.mode: HTML ``` 具体操作可查看[Thymeleaf 3示例](https://github.com/spring-projects/spring-boot/tree/v1.4.1.RELEASE/spring-boot-samples/spring-boot-sample-web-thymeleaf3)。 如果正在使用其他自动配置的Thymeleaf附加组件(Spring Security,Data Attribute或Java 8 Time),你需要使用兼容Thymeleaf 3.0的版本覆盖它们现在的版本。