一.添加依赖
<!-- 启动热部署
1.当代码改变 保存时
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>true</scope>
</dependency>
二.添加插件
<build>
<plugins>
<!-- maven 插件 添加spring-boot-maven-plugin: -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
三.开启idea自动make功能
1.Idea默认没有开启自动编译功能,要按一下Ctrl+F9(build==>build product)
Ctrl+Shift+A查询make project automatically
2.CTRL + SHIFT + A --> 查找Registry
勾选compiler.automake.allow.when.app.running
致此,就完成了对Springboot的热部署问题!
注意,单工程项目可以用此热部署,多项目最好不要用,问题很坑