1.pom.xml文件添加依赖

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

2.application.yml中添加配置

spring:
  devtools:
    restart:
      enabled: true
      additional-paths: srcc/main/java
  freemarker:
    cache: false

3.idea的setting中开启自动编译

idea下springboot 热部署配置_java

4.Shift+Ctrl+Alt+/,选择Registry,勾选下面的选项

idea下springboot 热部署配置_xml文件_02