1、在pom.xml中加入Springboot专用的开发工具:DevTools
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-devtools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>1.5.14.RELEASE</version>
<optional>true</optional>
</dependency>
2、在pom.xml中配置插件
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
3、设置自动编译保存后的Java文件
4、idea 注册 自动编译功能(默认是关闭状态),快捷键 Ctrl + Shift + Alt + / ,然后选择 register 找到 complier.automake.allow.when.app.running 然后打开就可以了。(亲测有效!!!)