来自: https://blog.csdn.net/Luck_ZZ/article/details/79361497
在Maven中添加依赖
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.22</version>
</dependency>
在配置文件application.properties中,对thymeleaf模板设置。
LEGACYHTML5需要搭配NekoHTML库才可用,实现thymeleaf非严格检查。
#thymeleaf
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.suffix=.html
#默认严格检查
#spring.thymeleaf.mode=HTML5
#非严格检查
spring.thymeleaf.mode=LEGACYHTML5