SpringBoot项目如何实现热部署

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

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

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、配置项目启动加载方式

在这里插入图片描述

7、修改内容后Ctrl+S,立马见效
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值