74.9使用Thymeleaf 3
默认情况下,spring-boot-starter-thymeleaf
使用Thymeleaf 2.1。如果您使用的是 spring-boot-starter-parent
,您可以通过重写thymeleaf.version
和thymeleaf-layout-dialect.version
属性来使用Thymeleaf 3 ,例如:
<properties> <thymeleaf.version> 3.0.2.RELEASE </thymeleaf.version> <thymeleaf-layout- dialect.version> 2.1.1 </thymeleaf-layout-dialect.version> </ properties>
如果您自己在管理依赖关系,请查看 |
为了避免对被弃用的HTML 5模板模式和HTML模板模式的警告信息被用来代替,你可能还需要明确配置 spring.thymeleaf.mode
为HTML
,例如:
spring.thymeleaf.mode:HTML
请参阅 Thymeleaf 3样本以查看这一行动。
如果您正在使用任何其他自动配置的Thymeleaf Extras(Spring安全性,数据属性或Java 8时间),您还应该将其每个版本覆盖为与Thymeleaf 3.0兼容的版本。