spring boot項目 熱部署 一,參考文檔:springboot 熱部署 note: 1.使用eclipse: project Build Automatically (選中) 2.Digital Twin 項目使用Spring boot 版本為:1.2.3.RELEASE,使用spring ...
spring boot項目 熱部署
一,參考文檔:springboot 熱部署
note:
1.使用eclipse: project-->Build Automatically (選中)
2.Digital Twin 項目使用Spring boot 版本為:1.2.3.RELEASE,使用spring-boot-devtools無效. 查看Spring-boot-devtools,最低版本為1.3.0. 猜測Spring boot 整合Spring-boot-devtools最低版本為1.3.0
3.把SpringLoaded放入spring-boot-maven-plugin中,會導致埠占用,需要用控制面板關閉java程式,所有不推薦
二.3種方式的使用
1.使用springloaded 放入spring-boot-maven-plugin中(埠會被占用,不推薦)
在pom文件添加依賴
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.6.RELEASE</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
2.spring-boot-devtools(Springboot 版本為1.3.0以上,推薦)
添加pom文件依賴
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 這個需要為 true 熱部署才有效 -->
</dependency>
如果我們想指定讓 devtools 監聽指定文件夾,那麼可以在 application.yml 配置
spring.devtools.restart.additional-paths=your path
3.使用springloaded ,下載springloaded常用版本(如:springloaded-1.2.3.RELEASE.jar)放入指定路徑下(推薦)
啟動項目:Application文件-->run as--> Run configurations...-->Arguments-->VM arguments
-javaagent:D:/javasoft/springloaded-1.2.3.RELEASE.jar -noverify