首页 > 技术文章 > SpringBoot 热部署配置

jiehao-yu 2021-04-10 12:59 原文

SpringBoot 热部署配置

什么是热部署?

修改java类或者页面静态文件不需要手动重启(适合本地开发环境)

原理:类加载器

1.添加maven依赖

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

2.在IDEA工具中进行设置

首先进入 File --> Build,Execution,Deployment --> Compiler--> 勾上 Build project automatically 。如下图:

image-20210410125748505

然后使用组合键 “ Shift+Ctrl+Alt+/ ” ,选择 “Registry” ,选中 “ compiler.automake.allow.when. app.running ” 打钩即可

image-20210410125802580

推荐阅读