首先在 application.properties 中的 dependencies标签段中加入:
<!-- spring boot 热部署 stat-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<!-- spring boot 热部署 end -->
然后 将 build中的 org.springframework.boot 添加一个configuration标签 修改完后如下:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
</configuration>
</plugin>
</plugins>
</build>
然后更改idea设置
第一步:
file > settings > Build, Execution, Deployment > Compiler
把里面的 Build Project automatically 勾选上
第二步:
ctrl + shift + alt + /,选择Registry
把里面的 Compiler autoMake allow when app running 勾上 然后直接close
热部署配置完成