Spring Boot 热部署

需要在pom.xml文件中加如下代码:

 1 <dependencies>
 2     <dependency>
 3         <groupId>org.springframework.boot</groupId>
 4         <artifactId>spring-boot-devtools</artifactId>
 5         <optional>true</optional>
 6     </dependency>
 7 </dependencies>
 8 
 9 <build>
10     <plugins>
11         <plugin>
12             <groupId>org.springframework.boot</groupId>
13             <artifactId>spring-boot-maven-plugin</artifactId>
14             <configuration>
15                 <fork>true</fork>
16             </configuration>
17         </plugin>
18     </plugins>
19 </build>

 

 

 说明:

1.  optional=true,依赖不会传递,该项目依赖devtools;之后依赖改项目的项目如果想要使用devtools,需要重新引入。

2.  <fork>true</fork> 如果没有该项配置,devtools不会起作用,即应用不会热start。(但是经我测试,不加fork,项目一样可以restart)

 

补充:在IntelliJ  IDEA中实现Spring Boot热部署

一、开启idea的自动make功能

1.  ctrl + shift + a  --> 查找make project automatically --> 选中

 

2.  ctrl + shift + a --> 查找registry --> 找到并勾选 compiler.automake.allow.when.app.running 

3.  重启idea

 

via:

http://blog.csdn.net/zknxx/article/details/53428669

http://412887952-qq-com.iteye.com/blog/2300313

http://www.cnblogs.com/winner-0715/p/6666579.html

posted on 2017-09-13 22:11  whlshot  阅读(189)  评论(0编辑  收藏  举报

导航