springboot 熱部署
- 打開設定 --> 查找 build project automatically --> 選中
- 打開設定 --> 查找Registry --> 找到并勾選compiler.automake.allow.when.app.running
如果沒有這個配置項(新版本沒有):
打開設定 --> 查找Registry--->進入keymap 設定Registry 快捷鍵
找到并勾選compiler.automake.allow.when.app.running
- 然後重新開機idea
- 引入 jar 依賴
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
- 引入插件
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
- application.properties 裡添加
spring.devtools.restart.enabled=true
以上操作之後,熱部署配置成功,建議在 google開發者選項中,關閉浏覽器緩存,便于調試。