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