這裏記錄一下SpringBoot項目用到的熱部署插件Devtools
首先在要用到熱部署的模塊的pom.xml中添加上Devtools的依賴
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
然後在當前模塊或者父模塊的pom.xml中添加一個插件
<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>
然後點擊設置 將這四個打上√
最後在IDEA中按快捷鍵 ctrl+alt+shift+/ 彈出
點擊第一個 將這兩個打上√ 就OK啦 如果沒有成功 重啓一下IDEA
注意:熱部署僅在開發階段用,如果項目要上線 請關閉熱部署功能