pom.xml引入依赖html
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>
application.properties中配置:spring
##去除thymeleaf的html严格校验 spring.thymeleaf.mode=LEGACYHTML5 #设定thymeleaf文件路径 默认为src/main/resources/templates spring.freemarker.template-loader-path=classpath:/templates
模版html页面中,也是须要引入thymeleaf:后端
<html xmlns:th="http://www.thymeleaf.org">
为了解决html严格校验报错的问题,能够在pom.xml增添依赖nekohtmlspringboot
<dependency> <groupId>net.sourceforge.nekohtml</groupId> <artifactId>nekohtml</artifactId> <version>1.9.15</version> </dependency>