form1.cn
Make a little progress every day

SpringBoot项目在IntelliJ IDEA中实现热部署

22th of July 2017 Java Java 2317

IntelliJ IDEA是自动保存的,所以当你敲完代码后他马上会进行重启,当然这个重启的时间要比你手动重启快,一般在5秒内可重启完成


1、CTRL + SHIFT + A --> 查找make project automatically --> 选中 


2、CTRL + SHIFT + A --> 查找Registry --> 找到并勾选compiler.automake.allow.when.app.running 


3、加maven依赖

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


4、开启热部署

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


最后重启idea