springboot整合devtools热部署工具
1.pom.xml引入依赖
<!-- 热部署模块 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 这个需要为 true 热部署才有效 -->
</dependency>
2.pom.xml设置配置
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork><!-- 如果没有该配置,热部署devtools不会生效 -->
</configuration>
</plugin>
</plugins>
</build>
3.application.yml添加配置
# 服务模块
devtools:
restart:
# 热部署开关
enabled: true
#执行重新加载路径
additional-paths: src/main/java
4.如果有集成thymeleaf模板引擎
将 cache设置为false
# thymeleaf模板引擎
thymeleaf:
# 模板引擎
thymeleaf:
mode: HTML
encoding: utf-8
# 禁用缓存
cache: false
5.idea中需修改设置
菜单栏点击File-》Settings-》Build,Execution,Deployment 将Build project automatically打勾

快捷键Ctrl+Shirt+Alt+/,选择Registry,找到compiler.automake.allow.when.app.running打勾

浙公网安备 33010602011771号