导入thymeleaf的依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
创建templates文件夹
写HTML文件
写Controller
thymeleaf禁用缓存
将thymeleaf的cache属性置为false,不使用thymeleaf的缓存功能。
spring:
thymeleaf:
cache: false
pom.xml加入,引入devtools
<!-- 热部署 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<!-- 启用 -->
<optional>true</optional>
</dependency>
修改IDEA的两处配置
1,file —> setting —>Compiler,启用自动build
2,IDEA中按下快捷键:ctrl + shift +alt + / ,调出如下面板