1.添加maven依賴
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-devtools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
2.把配置黏貼到父工程當中的pom裡
<build>
<plugins>
<plugin>
<!--熱部署-->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.2.2.RELEASE</version>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
</configuration>
</plugin>
</plugins>
</build>
3.在idea打開settings并找到Compiler
(把選中的點上勾)

4. 操作 Ctrl+shift+Alt+/
(進入1.Registry)
5.選中紅色箭頭所指的地方并勾選
6.重新開機idea