前言:每次修改代码时,我们都需要重启服务,比较麻烦。热启动可以允许我们在修改代码保存之后,自动重启服务,无需再去手动重启。
1、添加spring-boot-devtools的包,true必须加上
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
2、修改spring-boot-maven-plugin插件
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!--fork:如果没有该项配置,整个devtools不会起作用-->
<fork>true</fork>
</configuration>
</plugin>
3.File----》Setting---》complier---》勾选上Build Project automatically
4.快捷键 ctrl + shift + alt + /,选择Registry,勾上 Compiler autoMake allow when app running
到此配置完成