大前提:你的IDEA是Ultimate版本,可以去官网申请,可以用校园邮箱免费申请
1.取消自动编译(对的,是取消,后面有解释)
2.启用可以运行时自动编译 快捷键 Ctrl+Shift+Alt+/ 选Registry
3.Maven设置
<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>
4.虽然IDEA有自动保存的功能,但是他的自动保存功能过于快,并且这个功能相关的触发器还有很多,依赖这个自动保存的话热启动会很频繁,所以不建议使用该方法。
做法是取消自动编译,在需要自动部署的时候手动编译工程即可。快捷键是Ctrl+F9。