本文作者:PlenKuing 轉載自簡書:https://www.jianshu.com/p/8475553fbc43
熱部署的作用
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
-
找到選項打勾