SpringBoot实现热部署两种方式

SpringBoot实现热部署两种方式

第一种

第一步:修改pom.xml文件

<!-- 热部署依赖-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
            <!-- optional=true,依赖不会传递,该项目依赖devtools;之后依赖myboot项目的项目如果想要使用devtools,需要重新引入 -->
        </dependency>

<!-- 添加下面的fork属性为true-->
<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <!--fork :  如果没有该项配置,devtools不会起作用,即应用不会restart -->
                    <fork>true</fork>
                </configuration>
            </plugin>
        </plugins>
    </build>

第二步:设置自动编译
这里写图片描述

第三步:注册为当app运行的时候自动去编译
idea快捷键:shift+ctrl+alt+/
这里写图片描述

这里写图片描述

结束

第二种springloaded方式

这里写图片描述

猜你喜欢

转载自blog.csdn.net/a656678879/article/details/80356323