热启动

在开发过程中,当写完一个功能我们需要运行应用程序测试时需要重启服务器,一个最简单的项目也要花费10多秒,如果是更大的项目则耗时更多。SpringBoot提供了spring-boot-devtools,使得项目在发生改动时能够自动重启应用

idea社区版设置

菜单栏FIle->Settings…

idea社区版(2023.1)设置spring boot项目热启动_java


勾选Build project automatically菜单栏FIle -> Settings… -> Advanced Settings

idea社区版(2023.1)设置spring boot项目热启动_spring boot_02


勾选Allow auto-make to start even if developed application is currently running

maven包配置

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-devtools</artifactId>
</dependency>

配置文件

新增

spring.devtools.restart.enabled=true

idea社区版(2023.1)设置spring boot项目热启动_spring boot_03

成功!


阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
标签: Spring