1、引入spring-boot-devtools maven依賴
2、開啓idea自動build功能
3、組合鍵:Shift+ALT+Ctrl+/ ,選擇“Registry”,回車,找到“complier.automake.allow.when.app.running”
4、 設置maven plugin屬性 <fork>true</fork> <!-- fork is enable,用於明確表示編譯版本配置的可用 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!--fork : 如果沒有該項配置,devtools不會起作用,即應用不會restart -->
<fork>true</fork>
</configuration>
</plugin>