IDEA中Spring boot配置热部署无效问题解决方式

本文介绍了在IDEA中解决Spring Boot应用热部署无效的问题。通过在pom.xml文件添加devtools依赖,并调整IDEA设置:开启'Build project automatically'及在Registry中启用'compiler.automake.allow.when.app.running',可以成功实现热部署。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

该配置方式属于通过配置devtools实现热部署

只要在pom文件中添加下面代码段即可

<!-- 热部署 -->
    <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>
          <!-- 没有该配置,devtools 不生效 -->
          <fork>true</fork>
          <addResources>true</addResources>
        </configuration>
      </plugin>
    </plugins>
  </build>

但是配置好无效,下面需要修改idea中的两个配置

  1. setting –> compiler
    将 Build project automatically 勾选上
  2. alt + shift + a 搜索 registry 选第一个,弹出框后下拉找到 compiler.automake.allow.when.app.running 勾选上即可。

热部署无效问题已解决。

评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值