pom.xml配置
<dependency> <!--实现springboot的热加载-->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>true</scope>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--springboot 热加载 fork : 如果没有该项配置,肯定devtools不会起作用,即应用不会restart -->
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
最后就回到我们的idea软件里
打开 Settings --> Build-Execution-Deployment --> Compiler
,将 Build project automatically.
勾上。
使用快捷键 Ctrl+Shift+A
打开窗输入Registry
将 其中的compiler.automake.allow.when.app.running
勾上
操作完毕以后,重启idea,然后在代码里任意修改下,看看是否有热加载了