Springboot 热部署配置(修改代码时自动热部署)(Springboot hot deployment configuration (automatic hot deployment when modifying code))

# Springboot热部署配置前言:在开发项目过程中,频繁的修改代码、运行项目会感觉很麻烦,尤其是当项目复杂时、每次重新运行项目都需要大量时间

部署后可达到改动代码自动实现热部署

# 1.Adding devtools to your project

~~~xml<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId></dependency>~~~

# 2.Adding plugin to your pom.xml

~~~xml<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.3.5.RELEASE</version> <configuration> <fork>true</fork> <addResources>true</addResources> </configuration> </plugin> </plugins> </build>~~~

# 3.Enabling automatic build

确定自动构建、并行编译、重建模块打勾

![在这里插入图片描述](https://img-blog.csdnimg.cn/a5b48d4a0dce47baaa37676aff9629cb.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBALUJEc25ha2Ut,size_20,color_FFFFFF,t_70,g_se,x_16)

# 4.Update the value of

**Ctrl+Alt+Shift 打开注册表**

![\[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ATS9k42s-1642214449119)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20220115103120216.png)\]](https://img-blog.csdnimg.cn/b2820ef52452436e9ca365a1c81fa749.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBALUJEc25ha2Ut,size_19,color_FFFFFF,t_70,g_se,x_16)

![\[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-neOngbjk-1642214449119)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20220115103224085.png)\]](https://img-blog.csdnimg.cn/f6a3f7af32db49608da34acc89fcb23c.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBALUJEc25ha2Ut,size_19,color_FFFFFF,t_70,g_se,x_16)

以上两个选项打钩

# 5. 重启idea

————————

#Spring boot hot deployment configuration foreword: in the process of developing a project, it will be very troublesome to frequently modify the code and run the project, especially when the project is complex, it takes a lot of time to re run the project every time

After deployment, the code can be changed to automatically realize hot deployment

# 1.Adding devtools to your project

~~~xml<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId></dependency>~~~

# 2.Adding plugin to your pom.xml

~~~xml<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.3.5.RELEASE</version> <configuration> <fork>true</fork> <addResources>true</addResources> </configuration> </plugin> </plugins> </build>~~~

# 3.Enabling automatic build

Confirm automatic build, parallel compile and rebuild modules and tick

![在这里插入图片描述](https://img-blog.csdnimg.cn/a5b48d4a0dce47baaa37676aff9629cb.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBALUJEc25ha2Ut,size_20,color_FFFFFF,t_70,g_se,x_16)

# 4.Update the value of

**CTRL + Alt + Shift open registry**

![\[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ATS9k42s-1642214449119)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20220115103120216.png)\]](https://img-blog.csdnimg.cn/b2820ef52452436e9ca365a1c81fa749.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBALUJEc25ha2Ut,size_19,color_FFFFFF,t_70,g_se,x_16)

![\[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-neOngbjk-1642214449119)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20220115103224085.png)\]](https://img-blog.csdnimg.cn/f6a3f7af32db49608da34acc89fcb23c.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBALUJEc25ha2Ut,size_19,color_FFFFFF,t_70,g_se,x_16)

Tick the above two options

# 5. Restart idea