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