SpringBoot學習:使用spring-boot-devtools進行熱部署
阿新 • • 發佈:2019-01-27
1.新增架包
<!--支援熱啟動jar包--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <version>${spring-boot.version}</version> <optional>true</optional> <!-- optional=true,依賴不會傳遞,該專案依賴devtools;之後依賴該專案的專案如果想要使用devtools,需要重新引入--> </dependency> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> </configuration> <dependencies> <!--spring熱部署--> <!-- https://mvnrepository.com/artifact/org.springframework/springloaded --> <dependency> <groupId>org.springframework</groupId> <artifactId>springloaded</artifactId> <version>1.2.6.RELEASE</version> </dependency> </dependencies>
</plugin>
2.devtools的配置spring.devtools.restart.enabled: true
#設定重啟的目錄
#spring.devtools.restart.additional-paths: src/main/java
#classpath目錄下的WEB-INF資料夾內容修改不重啟
spring.devtools.restart.exclude: WEB-INF/**
3.IDEA配置 File-Settings-Compiler-Build Project automatically
選中 Make Project authomatically
ctrl + shift + alt + /,選擇Registry,勾上 Compiler autoMake allow when app running