- 在pom文件中添加maven依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>true</scope>
</dependency>
- 在 < build> 下面 < plugins> 里的添加如下代码
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--热部署配置-->
<configuration>
<!--fork:如果没有该项配置,整个devtools不会起作用-->
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
- File --> Setting --> complier -->勾选Build Project automatically
- 快捷键 ctrl + shift + alt + /,选择Registry,勾上 Compiler autoMake allow when app running (编译器自动允许当应用程序运行)
- 此时大功告成,修改代码后,不用重启程序访问的也是修改后的内容,若没效果,可稍等片刻。