在pom文件中,增加spring-boot-devtools
<!--实现热加载-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>true</scope>
</dependency>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
配置完成了之后,启动spring boot
通过快捷键 ctr+f9 在手动编译。
这样不重启项目,是实现了类重新的发布了