Springboot项目使用 devtools进行热部署

版权声明:博主原创/资料整理,转载请注明出处!! https://blog.csdn.net/tiegenZ/article/details/80913976

开发工具:IDEA   使用maven管理jar包

在pom.xml中添加相关jar包

<dependency>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-devtools</artifactId>
     <optional>true</optional>
</dependency>

在application.properties文件中配置热部署相关数据

#关闭缓存,及时更新
spring.thymeleaf.cache=true
#热部署生效
spring.devtools.restart.enabled=true
#设置监控重启的目录
spring.devtools.restart.additional-paths=src/main/java

设置IDEA

步骤一:"File"->"Settings"->"Build,Execution,Deplyment"-> "Compiler",勾选Build project automatically项 .


步骤二: 按组合快捷键"Shift+Ctrl+Alt+/",选择 “Registry",勾选"compiler.automake.allow.when.app.running" .(里面有很多项,可以直接搜索)

设置浏览器禁用缓存

我使用的是谷歌浏览器配置方法如下:

F12打开开发者工具,勾选Network项下的“Disable cache”


猜你喜欢

转载自blog.csdn.net/tiegenZ/article/details/80913976