1)加入maven 依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
2)将 maven-plugin 添加到父工程的pom文件中
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> <addResources>true</addResources> </configuration> </plugin> </plugins> </build>
3)setting->build->compile 中,将红框中的内容勾上
4)按住 shift+alt+ctrl+/ ,并选择Registry
5)勾选如下内容
此时改动代码后,会自动重启项目!!