IDEA 中SpringBoot项目配置热部署devtools

2022-05-27  本文已影响0人  想象之中丶意料之外

SpringBoot项目中,利用spring-boot-devtools依赖进行配置热部署

步骤

1、设置pom.xml

<!-- dependencies中添加 spring-boot-devtools依赖 -->
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
    </dependencies>

    <!-- build中添加spring-boot-maven-plugin插件,版本跟springboot版本要一直 -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.6.6</version>
                <configuration>
                    <fork>true</fork>
                    <addResources>true</addResources>
                </configuration>
            </plugin>
        </plugins>
    </build>

2、IDEA设置项目自动构建

3、设置maintenance

4、 重启IDEA,确保设置生效。

注意:

说明

1、如果开启热部署后,发现idea的cpu使用率很高,建议:

上一篇 下一篇

猜你喜欢

热点阅读