idea 热部署作用:自动帮开发者重启 spring boot 项目,从而达到修改代码之后能够“实时”的看到最新的效果
1.添加热部署框架支持
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
可以使用 idea 插件 EditStarters 来快速添加热部署框架支持

下载完成后,就可以在 pom.xml 中使用插件搜索框架支持了


可以看到添加成功

2.Settings 开启项目自动编译
开启 idea 的自动编辑,需要设置 idea 的两个 settings


3.开启程序运行中的热部署
不同的版本配置不同,配置分为 2021.2 之前的版本 和 2021.2 之后的版本
这里如果有这个放大镜点直接击搜索,如果没有就按 ctrl + F 试试

如果是 idea版本在 2021.2之前的,在这里直接就能搜索到 running,直接勾选,然后注意一定要点击 Close,因为另一个是恢复默认选项,一定不要点错了
如果是 idea 版本在 2021.2之后的,在Registry中是没有running(我的idea就是 2021.2 之后的)可以在 Settings 中找到 running 这个选项,然后选中,ok就可以了


4.使用 Debug运行程序
