springboot使用devtool进行热部署(开发工具IntelliJ IDEA)

1、首先在项目的pom.xml加入依赖:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
    <scope>true</scope>
</dependency>
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <!--必须加入下面的配置才可以使devtool 进行restart-->
                <fork>true</fork>
                <!--支持静态文件的热部署-->
                <addResources>true</addResources>
            </configuration>
        </plugin>
    </plugins>
</build>

2、在项目中加入依赖后,接下来需要设置开发工具IntelliJ IDEA:

  (1)、设置File-->Settings-->Compiler,勾选Build project automaticatlly。


(2)、使用快捷键ctrl+shift+alt+/ ,选择Registry,找到compiler.automake.allow.when.app.running,勾上开启此功能即可:


完成以上步骤,项目就可以实现自动热部署。

猜你喜欢

转载自blog.csdn.net/tobeng/article/details/80703346
今日推荐