开启热部署

说明:开发的时候打开热部署,项目上线的时候一定要关闭热部署

1.添加devtools依赖,写在本模块中

    <!--般为通用配置-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>

2.添加maven插件依赖,如果有父项目,将此插件写在父pom中即可

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

3.在idea中开启自动编译的权限

4.注册

这时会出现以下内容

5.重启idea

原文地址:https://www.cnblogs.com/wxl123/p/12571193.html