文章目录
SpringBoot项目如何实现热部署
1、在pom文件中添加spring-boot-devtools依赖
<!--热部署工具-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>2.1.10.RELEASE</version>
<!-- optional=true,依赖不会传递-->
<!-- 本项目依赖devtools;若依赖本项目的其他项目想要使用devtools,需要重新引入 -->
<optional>true</optional>
<scope>true</scope>
</dependency>
2、pom文件中添加配置
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
</configuration>
</plugin>
</plugins>
</build>
3、修改环境变量
将Build project automatically勾选上

4、搜索Registry
方法①:双击Shift搜索Registry
方法②:Ctrl+Shift+A + Registry

5、找到Compiler autoMake allow when app running
将Compiler autoMake allow when app running勾选上

6、配置项目启动加载方式

本文详细介绍了如何为SpringBoot项目配置热部署,包括在pom.xml中添加spring-boot-devtools依赖,设置fork和addResources属性,启用编译器自动构建以及Registry中的相关设置,确保修改代码后即时生效。
928

被折叠的 条评论
为什么被折叠?



