IDEA中SpringBoot项目配置热部署

springboot项目开发,热部署让我们不用修改代码之后,反复关闭应用,重启应用。提高开发效率。但是配置热部署,需要注意以下几个方面。

1、依赖设置: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、编译设置:File->Settings->Build,Execution,Deployment->Compiler:选中 Build project automatically

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

app.running

选中compiler.automake.allow.when.app.running复选框。 

以上四步,可以解决设置热部署,以及设置了热部署不生效的问题。

另外,页面的热部署,可以通过前端模板类型来设置,如果使用springboot自带的渲染模板thymeleaf,设置方式是在application.yml配置文件中加入如下配置:

spring:
  thymeleaf:
    cache: false

 

  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

luffy5459

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值