1、pom.xml文件中添加依赖
(1)、父子聚合工程的情况
-
在子工程的pom.xml文件添加如下代码:
org.springframework.boot spring-boot-devtools runtime true
-
在父工程的pom.xml文件添加如下代码:
org.springframework.boot spring-boot-maven-plugin true true
(2)、单体工程的情况
-
直接在pom文件中添加如下代码:
org.springframework.boot spring-boot-devtools runtime true org.springframework.boot spring-boot-maven-plugin true true
2、依次点击【File】——>【Settings…】——>【Build,Execution,Deployment】——>【Compiler】,如下图的4个选项全部勾选。
3、同时按住【Ctrl+Shift+Alt+/】,弹出如下窗口,点击【Registry…】
4、在弹出的Registry窗口中,勾选【compiler.automake.allow.when.app.running】和【actionSystem.assertFocusAccessFromEdt】,如下所示:
5、重启idea工具,热部署生效。