zl程序教程

您现在的位置是:首页 >  Java

当前栏目

SpringBoot热更新

2023-02-18 16:44:26 时间

步骤一

pom.xml 中在加入依赖

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
    <scope>true</scope>
</dependency>

然后再<build>下添加如下依赖。

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

步骤二

(1)打开设置勾选自动构建项目

(2)高级设置中勾选自动 make,老版 IDEA 需要ctrl + shift + alt + /,选择注册表,勾上 Compiler autoMake allow when app running,但新版中移到高级设置中。

接着启动项目,修改文件即可自动热加载,无需手动重新运行。