1. 引入依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>true</scope>
</dependency> 2.配置文件application中加入:
#开启热部署
spring.devtools.restart.enabled=true
#热部署目录
spring.devtools.restart.additional-paths=src/main/java
#不需要热部署目录
spring.devtools.restart.exclude=static/**,public/**3.idea配置:
ctrl+Shift+Alt+/ -----> 选择Registry ------>勾选 compiler.automake.allow.when.app.running
如果你进行上面的设置没有作用,检查 Setting--->Compiler--->勾选Build project automatically