pom.xml中的依赖:
<!-- thymeleaf 模板 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
application.yml中的配置:
spring:
#页面
thymeleaf:
#关闭thymeleaf缓存 开发时使用 否则没有实时画面
cache: false
#在构建URL时预先查看名称的前缀
prefix: classpath:/templates/
#模板编码
mode: HTML5
#字符
encoding: utf-8
servlet:
#Content-Type值
content-type: text/html