Spring Boot 熱部署--更新無需重啟專案
阿新 • • 發佈:2018-11-27
開發過程中的一點點改動需要重啟專案是一件很煩的事情,浪費了很多時間。下面介紹Spring Boot本身提供一種非常簡單的熱部署方式。
# 新增依賴
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
# yml配置檔案
spring:
devtools:
restart:
#開啟或關閉
enabled: true
#無需重啟目錄
exclude: static/**
#需重啟目錄
additional-paths: src/main/java
# IDEA中設定
- Preferences | Build, Execution, Deployment | Compiler | Build project automatically
- Ctrl+Shift+Alt+/ | Registry | compiler.automake.allow.when.app.running勾選