在springboot2.3.4.RELEASE官方文档中,说到如果已经配置了@ConfigurationProperties
,那么需要配置spring-boot-maven-plugin以防spring-boot-configuration-processor被打包到java文件中,减少空间占用。
来源:https://docs.spring.io/spring-boot/docs/2.3.4.RELEASE/reference/html/appendix-configuration-metadata.html#configuration-metadata-annotation-processor-setup
但在springboot2.5文档(当前版本)就没用提到这一点了。查看2.4版本更新记录(https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.4-Release-Notes):
找到了答案:
When generating runnable Spring Boot jars, empty starter dependencies will now be automatically removed. Since most starters only provide transitive dependencies, there is little point in packaging them in the final jar.
Spring Boot annotation processors are also removed as well as they are only useful during the build. These are spring-boot-autoconfigure-processor and spring-boot-configuration-processor.
因为Spring Boot annotation processors只是在开发阶段被用到,所以springboot自动移除了,无需再手动移除了。