1.添加依赖
<!-- SpringBoot自带热加载开发工具 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
2.配置IDEA-1
Preferences(win下为Settings)->Build,Execution,Deployment->Build project Automatically 勾选上
3.配置IDEA-2
按中快捷键 shift+option+command+/(win 下为shift+alt+ctrl+/)选择registry
并勾选compiler.automake.allow.when.app.running
4.设置静态资源不热加载
application.yml
spring:
devtools:
## 热加载 静态资源不重启
restart:
exclude: templates/**,static/**