1、maven配置
pom文件中添加对应的maven依赖
<dependency>
<!-- 热部署-->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>true</scope>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
2、yml配置
src->resources->templates->application.properties
#配置文件
#热部署生效
spring.devtools.add-properties=true
#设置重启目录 监听目录
spring.devtools.restart.additional-paths=src/main/java
#设置classpath目录下的WEB-INF文件夹内容修改不重启
#spring.devtools.restart.exclude=static/**
3、IDEA配置
(1)File->Setting->Build,Execution,Deployment->Compile
勾选:Build project automatically
(2)快捷键:ctrl+alt+shift+/
选择:Registry
勾选:compiler.automake.allow.when.app.running