图文并茂spring-boot3 热部署配置(IntelliJ IDEA 2023.1)

1,119 阅读1分钟

🥚 版本情况

  • 🥫 JDK:17
  • 🥫 IDEA:IntelliJ IDEA 2023.1
  • 🥫 spring-boot:3.10

🧂 前言(踩坑)

  • 消失的 Compiler autoMake allow when app running 先看了网上找到的一些方法,到了下面这一步自己发现idea没有了这个选项。 ctrl + shift + alt + / ,选择Registry,勾上 Compiler autoMake allow when app running

没得说,重新再看看其他方法吧。 在这里插入图片描述

🍗 四步完成spring-boot热部署

🥗 1、下载热部署模块

        <!--  SpringBoot热部署		-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>

🥗 2、application.yml 或者application.properties添加dev-tools配置

  • 我这里用的yml格式的,在最后一栏添加了忽略热部署启动的文件
spring:
  devtools:
    restart:
      enabled: true
      exclude: application.yml,static/**,public/**

🥗 3、settings中勾选条目,设置热部署堆内存大小

  • 我这里直接全部勾选上了,堆内存设置了700 在这里插入图片描述

🥗 4、关闭IDEA的自动保存

  • 我是建议你关掉这个的,如果不关闭,idea默认的是每次操作代码文件后 5秒,会进行热启动,个人感觉这样用起来不舒服,还是自己写完以后 “CTRL + S” 保存一下比较舒服
  • 直接在settings中搜索 Editor 找到 Editor Tabs,勾线上图片中红色箭头标记的位置即可

在这里插入图片描述 完成以上四步,而后重启项目,就OK啦! 以上是本人亲测完成的,如果有什么出入的地方,还请评论区留言讨论。