1:pom文件添加依赖

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional> <!-- 表示依赖不会传递 -->
        </dependency>

2:application配置文件添加

spring:
  devtools:
    restart:
      # 热部署开关
      enabled: true

3修改idea中setting配置:file->settings->compiler->build project automatically

idea springboot 项目 热部署_springboot

4 按住ctrl+alt+shift+/,搜索Registry双击进去,点击面板搜索running,勾选下面的值

idea springboot 项目 热部署_springboot_02