Spring Boot 热部署
Spring Boot Application Live Reload (Hot Swap) With Intellij IDEA
添加 devtool 依赖
1
2
3
4
5<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>注意:还需要添加 maven 插件,否则无效
1
2
3
4
5
6
7<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>IDEA 开启自动编译
Settings –> Build, Execution, Deployment –> Compiler –> Build project automatically
IDEA 开启 automake 功能
CTRL + SHIFT + ALT + /
–> Registry –> compiler.automake.allow.when.app.running注意:调整触发热部署的延迟时间
compiler.automake.trigger.delay
compiler.document.save.trigger.delay
IDEA 配置更新时触发事件
Edit Configuration –> On ‘Update’ action –> Update classes and resources
注意:官方不推荐设置在失焦(On frame deactivation)的时候更新