SpringBoot熱部署配置
阿新 • • 發佈:2021-01-12
1.引入依賴
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency>
2.新增外掛
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> <addResources>true</addResources> </configuration> </plugin> </plugins></build>
3.yml中開啟熱部署配置
spring:
devtools:
restart:
enabled: true #開啟熱部署
4.idea中開啟自動編譯
勾選Build project automatically配置
File > Settings > build > Compiler > Build project automatically
使用 Ctrl + Shift + Alt + / 調出如下面板,選擇Registry
勾選下面這個選項
至此配置完成,啟動專案後修改程式碼後代碼也會自動載入,無需手動去重啟