Spring Boot 项目实现热部署

作者: FantJ | 来源:发表于2018-02-03 17:17 被阅读144次

    方法一:devtools

    Pom.xml中直接添加依赖即可:

        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-devtools</artifactId>
          <scope>provided</scope>
          <!--optional我没弄明白,都说必须为true,但我测试true,false,不加都可以-->
          <optional>true</optional>
        </dependency>
    

    通过项目主程序入口启动即可,改动以后重新编译就好。

    方法二:springloaded

    Pom.xml中直接在spring-boot插件中添加依赖即可:

          <plugin>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-maven-plugin</artifactId>
              <dependencies>
                <!-- spring热部署 -->
                <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>springloaded</artifactId>
                  <version>1.2.6.RELEASE</version>
                </dependency>
              </dependencies>
              <configuration>
                <mainClass>cn.springboot.Mainspringboot</mainClass>
              </configuration>
            </plugin>
    

    相关文章

      网友评论

      • sunny_Lee:Idea里用设置选项里用配置自动构建嘛?

      本文标题:Spring Boot 项目实现热部署

      本文链接:https://www.haomeiwen.com/subject/dgwuzxtx.html