SpringBoot在IntelliJ IDEA上热部署

SpringBoot提供了spring-boot-devtools模块实现热部署,修改代码无需重启服务。

maven引入

<!--热部署-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <scope>runtime</scope>
    <optional>true</optional>
</dependency>

maven的build标签添加

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <fork>true</fork> <!--设为true-->
            </configuration>
        </plugin>
    </plugins>
</build>

开启自动编译权限(IntelliJ IDEA为例):以自己需要勾选

在这里插入图片描述

勾选完退出,同时按:ctrl + shift + Alt + / ,点击Registry…

在这里插入图片描述

弹出窗口,勾选圈出内容

在这里插入图片描述

启动项目修改测试是否自动部署,如果不好使重启IDEA。

猜你喜欢

转载自blog.csdn.net/zhaoqingquanajax/article/details/114380245