IDEA配置热部署Devtools(微服务开发必备)

51 阅读1分钟

1. 在聚合父类总工程中引入pom

 <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>

2. 子工程引入Devtools.jar

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <scope>runtime</scope>
    <optional>true</optional>
</dependency>
<!--这里version自动引入父工程中指定的版本-->

3. IDEA中开启自动编译的配置

在这里插入图片描述

4. 开启热注册

同时按住 Shift + Ctrl + Alt + / ,选择 Registry… 回车,勾选
在这里插入图片描述
点击 Close。

5. 重启IDEA,运行测试