1,工程中添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>XXX</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
2,pom.xml中添加插件
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- 没有该配置,devtools 不生效 -->
<fork>true</fork>
<addResources>true</addResources>
</configuration>
</plugin>
3,在IDEA设置中开启自动编译的权限
4,热注册开启
按快捷键:ctrl+shift+alt+/,然后点击界面中出现的:registry,然后勾选:
5,重启IDEA