SpringClould进行Devtools热部署

当我们在使用SpringCloud搭建项目的时候,会有多个项目,每次修改东西的时候,都需要重新启动项目,这样的操作就比较繁琐。

为了提高工作的效率,避免每次频繁的重启项目,在子类pom文件中,我们可以引入devtools的maven依赖

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

在引入该依赖 之后还需要在父类pom文件中添加maven的plugins

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

将ADBC四个选项勾选上,使得本地项目能够自动编译。

最后在本项目上使用Ctrl+Shift+Alt+/

将项目的热部署配置上

 

posted @ 2020-07-30 22:28  魏小哥  阅读(299)  评论(0编辑  收藏  举报