SpringBoot热部署(SpringBoot+devtools)

SpringBoot热部署(SpringBoot+devtools)

1.添加SpringBoot devtools 依赖包.

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

2.添加构建节点

<!-- 构建节点. -->
    <build>
        <plugins>
            <!-- 这是spring boot devtool plugin -->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                      <!--fork :  如果没有该项配置,肯呢个devtools不会起作用,即应用不会restart -->
                    <fork>true</fork>
                </configuration>
            </plugin>            
        </plugins>        
    </build>

3.实现完上述步骤后便可实现spring的热部署,即当有检测到修改的时候springBotta会自动重新启动,注意我们的开发工具IDE的Progect->Build Automatically 选项要开启,否则热部署不能检测到代码变更。

posted @ 2017-08-06 22:08  十月围城小童鞋  阅读(133)  评论(0编辑  收藏  举报