1. 程式人生 > >spring boot+ Intellj idea devtool 設定熱部署

spring boot+ Intellj idea devtool 設定熱部署

兩步: 

一、

1、CTRL + SHIFT + A --> 查詢make project automatically --> 選中 
2、CTRL + SHIFT + A --> 查詢Registry --> 找到並勾選compiler.automake.allow.when.app.running 

最後重啟idea 

二、使用spring-boot-1.3開始有的熱部署功能 
1、加maven依賴 
Xml程式碼  收藏程式碼
  1. <dependency>  
  2.             <groupId>org.springframework.boot</
    groupId>  
  3.             <artifactId>spring-boot-devtools</artifactId>  
  4.             <optional>true</optional>  
  5.         </dependency>  

2、開啟熱部署 
Xml程式碼  收藏程式碼
  1. <build>  
  2.         <plugins>  
  3.             <plugin>  
  4.                 <groupId>org.springframework.boot</
    groupId>  
  5.                 <artifactId>spring-boot-maven-plugin</artifactId>  
  6.                 <configuration>  
  7.                     <fork>true</fork>  
  8.                 </configuration>  
  9.             </plugin>  
  10.         </plugins>  
  11.     </build>  


三、Chrome禁用快取 

F12(或Ctrl+Shift+J或Ctrl+Shift+I)--> NetWork --> Disable Cache(while DevTools is open) 

至此,在idea中就可以愉快的修改程式碼了,修改後可以及時看到效果,無須手動重啟和清除瀏覽器快取