在開發中如何使idea在不重啟項目時,修改文件后能夠即時編譯更新,是一個關鍵問題。
step01:加入devtool依賴
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
application.yml中添加配置項:spring.devtools.livereload.enabled = true :開啟熱部署
step02:idea設置修改
File” -> “Settings” -> “Build,Execution,Deplyment” -> “Compiler”,選中打勾 “Build project automatically”
step03:idea設置修改
組合鍵:“Shift+Ctrl+Alt+/” ,選擇 “Registry” ,選中打勾 “compiler.automake.allow.when.app.running”
重啟項目,修改文件即可即時生效