一、配置pom.xml
1、加载maven插件
<!--添加热部署-->
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-devtools</artifactId><optional>true</optional><scope>true</scope>
</dependency>
2、开启热部署
<!--热部署配置-->
<plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><!--fork:如果没有该项配置,整个devtools不会起作用--><fork>true</fork></configuration>
</plugin>
二、配置IDEA
1)设置IDEA的自动编译:
“File”→“Settings(Ctrl+Alt+S)”→“Build, Execution, Deplyment”→“Compiler”,选中“Build project automatically” 打勾
2)组合键 Shift+Ctrl+Alt+/,选择 Registry ,找到compiler.automake.allow.when.app.running,选中打勾。(或者CTRL + SHIFT + A --> 查找Registry)