Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move away from spring.factories for auto-configurations #29872

Closed
4 tasks done
mhalbritter opened this issue Feb 16, 2022 · 3 comments
Closed
4 tasks done

Move away from spring.factories for auto-configurations #29872

mhalbritter opened this issue Feb 16, 2022 · 3 comments
Assignees
Labels
status: noteworthy A noteworthy issue to call out in the release notes type: enhancement A general enhancement
Milestone

Comments

@mhalbritter
Copy link
Contributor

mhalbritter commented Feb 16, 2022

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:

  • Design and document a file format that can replace spring.factories for auto-configuration
  • Update the AutoConfigurationImportSelector and the ImportAutoConfigurationImportSelector to not use spring.factories anymore
  • Update documentation tooling in buildSrc to read the new file
  • Check with existing IDE and tool vendors to ensure the new format doesn't cause issues
@mhalbritter
Copy link
Contributor Author

mhalbritter commented Feb 17, 2022

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.

@hannah23280
Copy link

hannah23280 commented Feb 22, 2024

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.

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.

@wilkinsona
Copy link
Member

#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: noteworthy A noteworthy issue to call out in the release notes type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants