spring boot 热部署

有两种方式:Devtools 和 SpringLoader

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 这个需要为 true 热部署才有效(不加也好使)-->
</dependency>

回到idea正常界面,Mac使用快捷键shift+option+command+/,window上的快捷键是Shift+Ctrl+Alt+/,打开Registry,勾选

compiler.automake.allow.when.app.runningcompiler.automake.allow.when.app.running

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--<configuration>-->(不加也好使)
<!--<fork>true</fork> &lt;!&ndash;fork : 如果没有该项配置,肯呢个devtools不会起作用,即应用不会restart &ndash;&gt;-->
<!--</configuration>-->
</plugin>
</plugins>
</build>

-----------------------------------------------------------------------------------------------------------------------------------
SpringLoader->maven插件方式
SpringLoader->lib方式
springloader只能热部署后台代码
devtools是自动重新部署。
原文地址:https://www.cnblogs.com/hongchengshise/p/10508368.html