1、在springboto项目中使用thymeleaf标签,必须先添加依赖,如下。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
2、在application.properties中配置一些常用的thymeleaf,如下。
spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.check-template-location=true spring.thymeleaf.suffix=.html spring.thymeleaf.encoding=UTF-8 spring.thymeleaf.content-type=text/html spring.thymeleaf.mode=HTML5 spring.thymeleaf.cache=false
可参考博客:https://blog.csdn.net/ice_lemon_g/article/details/73609020