1.导入包坐标
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-devtools</artifactId><scope>runtime</scope><optional>true</optional></dependency>
2.pom.xml添加piugins插件并打开开关
<plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><version>2.2.2.RELEASE</version><configuration><fork>true</fork><addResources>true</addResources></configuration></plugin></plugins>
3.设置idea自动编译
File ->Settings ->Build, Execution, DeploymentAdvanced Setttings -> Compiler
4.Advanced Setttings设置
File ->Settings ->Advanced Setttings
5.重启IDEA