1.pom.xml文件中引入熱部署依賴
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
2.設置項目自動構建
設置路徑(快捷鍵Ctrl+Alt+S):File -> Settings -> Build, Execution, Deployment -> Compiler
3.允許項目啟動時自動構建
設置路徑:打開maintenance面板(快捷鍵Crtl+Alt+Shift+/) -> 選擇[1. Registry...] -> 勾選[compiler.automake.allow.when.app.running]
4.重新啟動IDEA(穩妥起見)
如果沒有生效,請嘗試清緩存刷新。Chrome瀏覽器快捷鍵Ctrl+F5