Using spring.factories to find auto-configuration classes is causing problems with our native work. We initially used it because the code was already available, but we want to offer an alternative in 2.7 and stop using spring.factories for auto-configuration in 3.0.
Task:
- [x] Design and document a file format that can replace spring.factories for auto-configuration
- [x] Update the
AutoConfigurationImportSelectorand theImportAutoConfigurationImportSelectorto not usespring.factoriesanymore - [x] Update documentation tooling in buildSrc to read the new file
- [x] Check with existing IDE and tool vendors to ensure the new format doesn't cause issues
Comment From: mhalbritter
The autoconfigurations are now annotated with @AutoConfiguration and are put in a file named META-INF/spring-boot/org.springframework.boot.autoconfigure.AutoConfiguration.
The autoconfigurations are listed each in a separate line, comments are supported with the # character, and empty lines are ignored.
See the current documentation.
Comment From: hannah23280
The autoconfigurations are now annotated with
@AutoConfigurationand are put in a file namedMETA-INF/spring-boot/org.springframework.boot.autoconfigure.AutoConfiguration.The autoconfigurations are listed each in a separate line, comments are supported with the
#character, and empty lines are ignored.See the current documentation.
when we create our own custom starter implementation, we just put @AutoConfiguration on the desired class. We do not have to manually add in the file META-INF/spring-boot/org.springframework.boot.autoconfigure.AutoConfiguration , right? This compiler will detect the presence of @AutoConfiguration class(es) and automatically generate such file for us and add those @AutoConfiguration annotated classes into the file for us.
Comment From: wilkinsona
https://github.com/spring-projects/spring-boot/issues/31228 is tracking providing an annotation processor that automatically generates the META-INF/spring-boot/org.springframework.boot.autoconfigure.AutoConfiguration file. Until that has been implemented, you should update it manually when you add a new @AutoConfiguration class.