操作步骤
1、添加spring-boot-devtools依赖
在 pom.xml 文件中添加 spring-boot-devtools 依赖
<!-- 热部署 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
2、IDEA 开启自动编译
在 IDEA 的设置里找到 Build project automatically 开关,勾选打开
3、IDEA 开启程序运行时允许自动编译
在 IDEA 里按 CTRL + ALT + SHIFT + / 找到 Registry 点击
然后找到 compiler.automake.allow.when.app.running 这个 key,后面打勾就可以了
这样就完成热部署的配置了