熱部署插件Devtools

這裏記錄一下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
在這裏插入圖片描述

注意:熱部署僅在開發階段用,如果項目要上線 請關閉熱部署功能

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章