在 IDEA 中設置 Spring Boot 熱加載
截至當前文章,IDEA 最新版本為:2021.2.1
1、引入spring-boot-devtools
包
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
2、點擊File》Settings》Advanced Settings
,選中以下選項
注意:有些老版本的 IDEA 是在注冊表中勾選改選項的,您可以按照如下步驟設置
1、快捷鍵:
shift+ctrl+alt+/
打開注冊表
2、找到
compiler.automake.allow.when.app.running
並勾選
3、點擊File》Settings》Build
,選中以下選項
最后,IDEA 好像時根據文件最后更改日期來判斷是否更新的,加入您連續按ctrl+s
保存文件,貌似不會觸發熱加載~