Spring boot的热部署

当把配置文件,比如yml也打到jar包后,如何修改配置,而又不用重新发布呢?

在jar包同一目录下,放置Application.yml (注意,不管jar包内是否此文件名)
修改配置文件后,重新启动jar包即可

在IDE里又是如何实现热部署呢?

1. pom中添加devtools依赖
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
</dependency>

2. File->Setting –> Build, Execution, Deployment –> Compiler–>Build project automatically 打上勾

可参考以下网址

https://docs.spring.io/spring-boot/docs/current/reference/html/howto-hotswapping.html

https://stackoverflow.com/questions/33349456/how-to-make-auto-reload-with-spring-boot-on-idea-intellij

---栖息之鹰(一个外表懒洋洋的内心有激情的程序员) 此博客为笔者原著,转载时请注明出处,谢谢!
原文地址:https://www.cnblogs.com/roostinghawk/p/7943811.html