1.首先加入开发工具依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
2.其次在build maven插件中开启热部署
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork> #主要是这里,开启
</configuration>
</plugin>
</plugins>
</build>
3.idea开启自动
![](https://i-blog.csdnimg.cn/blog_migrate/fa3eb40944cb4e93e310cd48248e5c24.png)
4.勾选compiler.automake.allow.when.app.running