IDEA配置springboot热部署(自动更新)

步骤一:开启IDEA的自动编译(静态)

file -> setting -> Build,Execution,Deployment -> Compiler -> 勾选 Build project automatically

步骤二:开启IDEA的自动编译(动态)

按住 Ctrl + Shift + Alt + / 然后进入Registry ,勾选自动编译并调整延时参数

compiler.automake.allow.when.app.running ---> 自动编译
compile.document.save.trigger.delay ---> 自动更新文件

网上极少有人提到compile.document.save.trigger.delay 它主要是针对静态文件如JS CSS的更新,将延迟时间减少后,直接按F5刷新页面就能看到效果!

 步骤三:开启IDEA的热部署策略(非常重要)

具体步骤:顶部菜单- >Edit Configurations->SpringBoot插件->目标项目->勾选热更新。

 步骤四:添加依赖

<!--添加热部署-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
            <scope>true</scope>
        </dependency>
<plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          <!--热部署配置-->
          <configuration>
            <!--fork:如果没有该项配置,整个devtools不会起作用-->
            <fork>true</fork>
          </configuration>
        </plugin>

  • 1
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
配置Spring Boot热部署,你可以按照以下步骤进行操作: 1. 在你的项目的pom.xml文件中,添加spring-boot-devtools的依赖,并确保在<optional>标签中设置为true。这样可以确保在开发阶段使用热部署功能。 2. 在maven-plugin上添加配置,以支持热部署。同时,确保修改IDEA设置,打开自动编译,并允许在程序运行过程中进行编译。 3. 修改spring-boot-maven-plugin插件的配置,设置<fork>标签为true。这样可以确保在重新启动应用程序时,使用新的类加载器加载修改后的类。 通过以上步骤,你就可以成功配置IDEA实现Spring Boot热部署的功能了。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [【SpringBoot学习】2、idea 配置 SpringBoot 热启动详解,和热启动失效解决方案](https://blog.csdn.net/qq_38762237/article/details/81094425)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [SpringBoot设置热部署(超详细)【IDEA版】](https://blog.csdn.net/weixin_43883917/article/details/115398023)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值