spring boot+ Intellj idea devtools 设置热部署

POM文件

 

[html] view plain copy
 
  1. <!--添加依赖-->  
  2. <dependency>  
  3.     <groupId>org.springframework.boot</groupId>  
  4.     <artifactId>spring-boot-devtools</artifactId>  
  5.     <!-- optional=true,依赖不会传递,该项目依赖devtools;  
  6.     之后依赖该项目的项目如果想要使用devtools,需要重新引入 -->  
  7.     <optional>true</optional>  
  8. </dependency>  

 

 

project增加

[html] view plain copy
 
  1. <build>    
  2.     <plugins>    
  3.         <plugin>    
  4.             <groupId>org.springframework.boot</groupId>    
  5.             <artifactId>spring-boot-maven-plugin</artifactId>    
  6.             <configuration>    
  7.             <!--fork :  如果没有该项配置,可能devtools不会起作用,即应用不会restart -->    
  8.             <fork>true</fork>    
  9.             </configuration>    
  10.         </plugin>    
  11.     </plugins>    
  12. </build>    

 

idea设置

1.“File” -> “Settings” -> “Build,Execution,Deplyment” -> “Compiler”,选中打勾 “Make project automatically” 

2.组合键:“Shift+Ctrl+Alt+/” ,选择 “Registry” ,选中打勾 “compiler.automake.allow.when.app.running” 


ctrl+shift+alt+/

 

 

 

缓存配置



1. application.properties

[html] view plain copy
 
  1. spring.thymeleaf.cache=false  


2. Chrome禁用缓存
F12或者“Ctrl+Shift+I”,打开开发者工具,“Network” 选项卡下 选中打勾 “Disable Cache(while DevTools is open)” 。

posted @ 2017-10-25 10:02  园芳宝贝  阅读(1922)  评论(0编辑  收藏  举报