1.添加热部署相关依赖
2.添加配置信息
3.设置自动build,开启自动编译
1添加热部署依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
2.配置信息
#热部署生效
spring.devtools.restart.enabled=true
#设置重启的目录,添加那个目录的文件需要restart
spring.devtools.restart.additional-paths=src/main/java
spring.devtools.restart.exclude=WEB-INF/**
3.修改idea
ctrl + shift + alt + /然后选择Registry,勾上 Compiler.autoMake.allow.when.app.running
okk!