1、maven配置
<!--修改html不要重启项目 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>2.0.6.RELEASE</version>
<optional>true</optional> <!-- 表示依赖不会传递 -->
</dependency>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
</configuration>
</plugin>
2、application.yml
# Spring配置
spring:
# 模板引擎
thymeleaf:
mode: HTML
encoding: utf-8
# 禁用缓存
cache: false
# 服务模块
devtools:
restart:
# 热部署开关
enabled: true
freemarker:
cache: false #页面不加载缓存,修改即时生效
3、idea设置
红框勾选
shift+ctrl+alt+/
选择registry,下图红框勾选