1:在pom.xml 中 配置

1
2
3
4
5
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>

注意:并不是pom.xml 的标签中

2: 如果有页面的话 禁止页面缓存

1
2
3
4
5
6
7
8
9
spring:
application:
name: XXX
aop:
proxy-target-class: true
thymeleaf:
cache: false
prefix: classpath:/templates/
mode: LEGACYHTML5

3:开启idea工具的自动编译功能

4:开启idea允许运行时编译

在 Advanced Settings 中,勾选 Allow auto-make to start even if the application is currently running

完成以上步骤 即可实现SpringBoot项目自动编译+热部署,这我们修改后的代码能够立刻看到效果,提高效率!