First, the introduction of dependence
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
Second, modify the configuration file
#热部署生效
spring.devtools.restart.enabled= true
#设置重启的目录
spring.devtools.restart.additional-paths= src/main/java
#classpath目录下的WEB-INF文件夹内容修改不重启
spring.devtools.restart.exclude= WEB-INF
Third, turn on automatic compilation of IDEA
- File --> Settings --> Compiler-Build Project automatically
- ctrl + shift + alt + /,选择Registry,勾上 Compiler autoMake allow when app running
![Here Insert Picture Description](https://img-blog.csdnimg.cn/20200216183211719.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQzOTAxNjkz,size_16,color_FFFFFF,t_70)