spring-boot-devtools
spring-boot-devtools是Spring Boot提供的一组开发工具,它可以提高开发者的工作效率。当开发者将spring-boot-devtools引入项目后,只要classpath路径下发生变化,项目就会自动重启,从而实现热部署的效果。这对于开发者在开发过程中无需手动重启应用,即可快速看到代码更改的效果非常有用。
总的来说,spring-boot-devtools是一个非常实用的工具,可以帮助开发者提高开发效率,减少手动重启应用的次数,从而更加专注于编写高质量的代码。
前置条件
- IntelliJ IDEA 2023.3.4
- Spring Boot 3.2.2
pom.xml
要在Maven项目中使用spring-boot-devtools,可以在pom.xml文件中添加相应的依赖,如下所示:
xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>application.yml
yaml
spring:
# 开发工具配置,重启时排除某些目录不进行重启
devtools:
restart:
enabled: true
exclude: "static/**,public/**"启用项目自动编译

Add Run Options


热更新配置完成。