(1)加入依赖
<!-- 热部署-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional><!-- 依赖不会传递-->
</dependency>
(2)application.yml中配置属性, 开启热更新
spring:
devtools:
restart:
enabled: true
additional-paths: /src/main/java
(3)Idea中进行设置
勾选以下内容
按shift+ctrl+alt+/
打开以下菜单
【注意】2022.3 idea没有以下选项, 需要在setting中进行设置(Advanced Settings -> Allow auto-make to start even if developed application is currently running)
启动springboot时, 出现restartedMain即为配置热部署成功!