1.在pom.xml文件中添加如下配置
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<!--當前項目的子項目如果不顯示依賴該jar包,並不會自動依賴-->
<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的自動build項目設置 file->build,...->Complier->將project automatically勾上
4.做如下設置 Help->Find Action 打開搜索框,並搜索Registry,選擇檢索列表第一項
5.找到compiler.automake.allow.when.app.running