SpringBoot热部署自动重启 spring-boot-devtools

本文详细介绍如何在IDEA中配置SpringBoot项目的热部署,包括添加spring-boot-devtools依赖、配置application.yml、设置IDEA自动加载及验证重启效果,帮助开发者实现代码修改后的即时预览。

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

IDEA springboot项目热部署设置

1.首先项目pom.xml依赖 spring-boot-devtools

  • pom依赖

      <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-devtools</artifactId>
          <optional> true </optional>
          <scope>runtime</scope>
      </dependency>
    
  • application.yml进行devtools配置

      spring:
        devtools:
          restart:
            # 默认情况下 resources 下的文件是不会检测更新的,这一样设置就会检测啦
            exclude: static/**,public/**
            enabled: true
    

2.首先将项目设置为自动加载

  • File/Other settings/Default Settings/

在这里插入图片描述

  • 快捷键 Ctrl + Shift +Alt + / (1.Register) 将compiler.automake.allow.when.app.running 勾上

在这里插入图片描述

3.重启Idea 修改个文件 看看是不是会自动重启啦?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值