springboot 在idea中实现热部署

SpringBoot的web项目,在每一次修改了java文件或者是resource的时候,都必须去重启一下项目,这样的话浪费了很多的时间,实现了热部署,在每一次作了修改之后,都会自动的重启

第一步:引入热加载的插件,springboot 1.3开始就有的

springboot 在idea中实现热部署

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

 

project 中添加spring-boot-maven-plugin,主要在eclipse中起作用,idea不需要加此配置,springboot 项目的话,应该是有此配置,加里面的内容即可。

 

 <build>

 <plugins>

 <plugin>

 <groupId>org.springframework.boot </groupId>

 <artifactId>spring-boot-maven-plugin </artifactId>

 <configuration>

 <fork>true </fork>

 </configuration>

 </plugin>

 </plugins>

 </build>

 

第二步 : idea设置(14版本)

1、点击: file ,Settings ,Build ,Execution,Deplment

 

springboot 在idea中实现热部署

 

然后记得apply,ok。

2、组合键:Shift+ALT+Ctrl+/ ,选择“Registry”,回车,找到“complier.automake.allow.when.app.running”

 

springboot 在idea中实现热部署

 

第三部: 如果你用的浏览器和我的一样,那么就禁用缓存

按F12(更多工具—->开发者工具),找到network,勾选Disable Cache。