1、添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
2、添加插件
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
</configuration>
</plugin>
3、开启自动编译
![在这里插入图片描述](https://img-blog.csdnimg.cn/87029ee0858b41f5ba1589244552f36f.png)
4、注册
ctrl+alt+shift+/
![在这里插入图片描述](https://img-blog.csdnimg.cn/509e337872b248e6a073d022f6e21a51.png)
![在这里插入图片描述](https://img-blog.csdnimg.cn/3f57b3603521476092544aee7ca674e4.png)
重启idea
启动项目
敲个回车或者修改代码,检测代码改动,会重启项目;
![在这里插入图片描述](https://img-blog.csdnimg.cn/4e25be67bd014fda9e1a8a833ff9cb40.png)