添加pom文件
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
第二步、设置IDEA的自动编译:
(1)File-Settings-Compiler勾选 Build Project automatically
重点 application.properties 里添加
spring.devtools.restart.enabled=true
快捷键 ctrl + shift + alt + /,选择Registry,勾上 Compiler autoMake allow when app running