SpringBoot启动热部署
SpringBoot启动热部署
1.在pom.xml中添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<!-- optional=true, 依赖不会传递, 该项目依赖devtools;
之后依赖boot项目的项目如果想要使用devtools, 需要重新引入 -->
<optional>true</optional>
</dependency>
![](https://img.haomeiwen.com/i4724335/8649284b6f9ce9e7.png)
2.修改application.properties文件
这一步根据实际情况来设置,一般可设置在开发环境即可;
spring.devtools.restart.enabled=true
![](https://img.haomeiwen.com/i4724335/e6bfebc3425a4e14.png)
3.idea的修改
3.1 File-Settings-Compiler-Build Project automatically
![](https://img.haomeiwen.com/i4724335/451c7ad181290284.png)
3.2
ctrl + shift + alt + /然后选择Registry,勾上 Compiler.autoMake.allow.when.app.running
![](https://img.haomeiwen.com/i4724335/2ebc8a10f7df688e.png)
4.修改java文件,然后保存;待控制台出现了以下数据表示重启完成;
![](https://img.haomeiwen.com/i4724335/9c43d99f4270ef5e.png)
5.开发的时候有时候热部署无效,还是得重启,不能死磕;
注:本文转载于:https://blog.csdn.net/qq_37598011/article/details/80778915