IDEA 配置Spring Boot 热部署

       由于在开发Spring Boot工程过程中,会经常出现边开发边调测时需要修改部分内容,而如果反复的去启动项目,项目过大的话,会十分浪费时间,故此开发时,热部署显得很重要,效率也会大大提升。参见:IDEA热部署SpringBoot

1. 添加maven依赖

      pom.xml文件中加入spring-boot-devtools依赖,如下:


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

2. maven插件设置

需要在spring-boot-maven-plugin插件中配置参数:

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

3.编译设置

IDEA中 File->Settings->Build,Execution,Deployment->Compiler:中勾选Build project automatically,如下图:

4.运行设置

       ctrl+shift+a 调起搜索,输入registry,点击第一项,打开Registry编辑框,找到compiler.automake.allow.when.

app.running

 

完成以上4步设置后,重启IDEA 即可。

注:亲自测试,发现spring-boot 2.2.x  版本不行,在2.0.x 版本可以。

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值