Luo Hao

idea spring boot热部署

rehoni / 2019-12-19


idea spring boot热部署

1. 引入spring boot devtools,添加maven依赖
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
2. 在maven中添加插件
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <!--fork :  如果没有该项配置devtools不会起作用,即应用不会restart -->
                    <fork>true</fork>
                    <addResources>true</addResources><!--支持静态文件热部署-->
                </configuration>
            </plugin>
3. 勾选File > Settings > Compiler-Build Project automatically

image-20191210211247985

4. 一些其他的方式

非常详细的热部署说明 http://tengj.top/2017/06/01/springboot10/