Devtools 介绍

devtools 修改代码之后自动化热部署


添加 Maven 依赖

1
2
3
4
5
6
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>

添加至父级工程中

1
2
3
4
5
6
7
8
9
10
11
12
13
<build>
<finalName>父级工程的名字(可加可不加)</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
</configuration>
</plugin>
</plugins>
</build>

开启 IDE 自动编译的选项

image-20200803103038625


开启热注册

同时按下 ctrl + shift + alt + / 选择 Registry

image-20200803103224958

image-20200803103424554

image-20200803103337277

勾选以上两个选项


重启 IDE