使用 spring-boot-devtools
 
spring-boot-devtools 是 Spring Boot 提供的开发工具模块,它可以自动检测到代码的变化并重启应用,实现热部署。
配置步骤:
-  
添加依赖: 在项目的
pom.xml中加入spring-boot-devtools依赖:<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> </dependency> 
IDEA 配置:
-  
启用自动编译:
- 打开 
File -> Settings -> Build, Execution, Deployment -> Compiler,勾选Build project automatically 
 - 打开 
 
      在勾选下图位置
 



















