今天在暨大给学生上课的时候,发现在 Spring Boot 项目中配置热部署的方式有一丢丢的改变,具体往下看。

最近还把 IDEA 更新到了 IntelliJ IDEA 2023.1 版本

Spring Boot 3.x 全新的热部署配置方式详解(IntelliJ IDEA 2023.1)

第一步,在 pom.xml 文件中添加依赖

<!--热部署配置 -->
 <dependency>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-devtools</artifactId>
     <!-- 表示依赖不向下传递 -->
     <optional>true</optional>
 </dependency>

第二步,配置 Build project automatically

如果你用的是 Windows 系统,请按照 file -> settings -> Build, Execution, Deployment -> compiler 这个路径找到 build project automatically 并勾上,最后 Apply 和 OK 即可;

如果你用的是 Mac 系统,请按照 IntelliJ IDEA -> settings -> Build, Execution, Deployment -> compiler 这个路径找到 build project automatically 并勾上,最后 Apply 和 OK 即可。

Spring Boot 3.x 全新的热部署配置方式详解(IntelliJ IDEA 2023.1)

第三步,开启允许在运行中修改文件

如果你用的是 Windows 系统,请按照 file -> settings -> Advanced Settings 这个路径找到 Allow auto-make to start even if developed application is currently running 并勾上,最后 Apply 和 OK 即可;

如果你用的是 Mac 系统,请按照 IntelliJ IDEA -> settings -> Advanced Settings 这个路径找到 Allow auto-make to start even if developed application is currently running 并勾上,最后 Apply 和 OK 即可;

Spring Boot 3.x 全新的热部署配置方式详解(IntelliJ IDEA 2023.1)

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。