IDEA-SpringBoot熱部署失效問題解決
阿新 • • 發佈:2020-12-04
熱部署的作用
springboot每次修改之後都需要重新啟動才會生效,啟動熱部署之後每次修改會自動重啟,而不用手動重啟,提高開發效率。
1.新增依賴
- <!-- SpringBoot熱部署 -->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-devtools</artifactId>
- <optional>true</optional>
-
<scope>true</scope>
- </dependency>
2.新增外掛
- <build>
- <plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <configuration>
- <!--沒有配置該選項devtools不起作用,即應用不會restart-->
-
<fork>true</fork>
- </configuration>
- </plugin>
- </plugins>
- </build>
3.設定application.properties
spring.devtools.restart.enabled=true
4.開啟自動編譯
- Ctrl+Alt+S開啟配置
-
設定自動編譯
設定
-
Ctrl+Shift+Alt+? 選擇Registry
Maintenance
-
找到選項打勾