spring-boot-devtools
POM集成方式:
<!-- 热部署模块 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 这个需要为 true 热部署才有效 -->
</dependency>
再开启自动打包插件
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
</configuration>
</plugin>
</plugins>
</build>
集成注意:
1、如果发现没有热部署效果,则需要检查IDE配置中有没有打开自动编译。
2、如果使用Thymeleaf模板引擎,需要把模板默认缓存设置为false
#禁止thymeleaf缓存(建议:开发环境设置为false,生成环境设置为true)
spring.thymeleaf.cache=false
3、Ctrl+Shift+Alt+/ 点击弹出框中Registry…
4.找到compiler.automake.allow.when.app.running后面打勾,Close即可