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