步骤一:导入依赖
通过修改pom文件或者向导中指定支持devtool:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
步骤二:配置文件
spring:
##热部署工具
devtolls:
restart:
enabled: true # 开启热部署
additional-paths: src/main/java #重启目录
exclude: templates/** #classpath目录下的templates文件夹内容修改不重启
步骤三:设置自动编译和允许运行时重新自动构建
允许运行时重新自动构建(划重点,这是新版调整过的,之前改registry配置,2021版intellij已经取消了)