1)加入maven 依賴
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
2)將 maven-plugin 添加到父工程的pom文件中
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> <addResources>true</addResources> </configuration> </plugin> </plugins> </build>
3)setting->build->compile 中,將紅框中的內容勾上
4)按住 shift+alt+ctrl+/ ,並選擇Registry
5)勾選如下內容
此時改動代碼后,會自動重啟項目!!