1.引用jar包
<!-- 热部署模块 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 这个需要为 true 热部署才有效 -->
</dependency>
2.在idea的pom中配置如下:
<build>
<plugins>
<!--//该配置必须-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--热部署-->
<configuration>
<!--//该配置必须-->
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
3.在idea中左上角
file->setting->build,Execution,Deployment->Compiler中的
Build project automatically打对勾
4.最后:
Ctrl+Alt+Shift+/
选择第一个Registry
从里面选择
compiler.automake,allow.when.app.running打对勾