- pom文件中导入 spring-boot-devtools 依赖:
<!--SpringBoot热部署配置 --><br><dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
- 添加pom插件
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
</configuration>
</plugin>
</plugins>
</build>
- 修改yml配置文件
spring:
#配置项目热部署
devtools:
restart:
enabled: true
- 修改idea配置 勾选Build project automatically
5. 按住ctrl + shift + alt + /,出现如下图所示界面,点击Registry…
点击进入后,勾选compiler.automake.allow.when.app.running后关闭即可