使用IDEA写代码的朋友们是否有这种苦恼:
每次修改页面样式、数据等内容,修改方法、类结构时,想在浏览器中查看最新的数据
往往页面刷新还是不出来最新的数据,这时重启这个项目就好了
然而重新启动项目,小的项目还好说,一旦项目大了点,整个项目的启动时间会非常长,严重耽误了撸代码的时间
解决办法
使用spring-boot-devtools实现热重启
在pom.xml中引入依赖
//在依赖中引入
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
//在plugins中引入
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>