springboot实现热部署操作方法

1、在 Spring Boot 开发环境下禁用模板缓存

#开发环境下关闭 thymeleaf 模板缓存,thymeleaf 默认是开启状态
spring.thymeleaf.cache=false

2.引入依赖

<!--热部署-->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-devtools</artifactId>
    </dependency>

3.Intellij IEDA 和 Eclipse 不同,Intellij IDEA 必须做一些小调整
在 Eclipse 中,修改文件后要手动进行保存,它就会自动编译,就触发热部署现象,而在 Intellij IEDA 中,修改文件后都是自动保存,默认不会自动编译文件,需要手动编译按 Ctrl + F9 (推荐使用)或 Build ->Build Project ;或者进行以下设置才会自动编译(效果不明显)。

1604496757641529

(File -> Settings -> Build, Execution, Deployment -> Compiler -> 勾选 Build project automatically)

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容