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-configuration imports #29698

Closed
8 tasks
philwebb opened this issue Feb 9, 2022 · 8 comments
Closed
8 tasks

Move away from spring.factories for auto-configuration imports #29698

philwebb opened this issue Feb 9, 2022 · 8 comments
Assignees
Labels
status: superseded An issue that has been superseded by another type: epic An issue tracking a large piece of work that will be split into smaller issues

Comments

@philwebb
Copy link
Member

philwebb commented Feb 9, 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.

The following required tasks have been identified:

  • Design and document a file format that can replace spring.factories for auto-configuration.
  • Update the existing import to use both spring.factories and the new entries.
  • Introduce a new @AutoConfiguration annotation which is meta-annotated with @Configuration. The new annotation will default proxyBeanMethods to false.
  • Document the changes in the reference docs and provide a wiki migration guide
  • 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

The following nice-to-have tasks have been identified:

  • Develop a migration tool to convert our existing codebase (a tool will be valuable for other project, but we might also be able to use sed)
  • Update our annotation processor so the the new auto-configuration file can be auto-generated

We will need to retain spring.factories support for the life of 2.x because Spring Cloud will not be able to migrate to a new system (since it supports 2.6)

@philwebb philwebb added this to the 2.7.x milestone Feb 9, 2022
@philwebb philwebb added the type: epic An issue tracking a large piece of work that will be split into smaller issues label Feb 9, 2022
@mhalbritter mhalbritter self-assigned this Feb 10, 2022
@wilkinsona
Copy link
Member

Due to @ImportAutoConfiguration support being implemented as a sub-class of AutoConfigurationImportSelector, I think we'll have to tackle it at the same time as working on this. I imagine we'll end up with another file for ImportAutoConfiguration classes. It can use the same format as the new file for AutoConfiguration.

@mhalbritter
Copy link
Contributor

@haydin505
Copy link

Hi @philwebb,

Can you explain the idea of setting proxyBeanMethods to false? I'm planing to use @AutoConfiguration but I want to proxy beans with CGLIB too. Can you give advice on the subject?

@wilkinsona
Copy link
Member

@haydin505 I see you also asked this on Stack Overflow where someone is already trying to help you. Please don't ask the same question in multiple places at the same time as it just wastes people's time.

@haydin505
Copy link

@wilkinsona I have researched the issue, traced design and development, then I asked direct question to the author of the issue. In other words, here I’m trying to gather information from the creator. On the other hand, in Stack Overflow I created a thread to discuss and realize new perspective. Hence, they are not duplicate, both questions has their own meaning. Thank for the feedback though.

@philwebb
Copy link
Member Author

philwebb commented Jun 6, 2023

@haydin505 It's quite time consuming for us when people ask questions here and we specifically ask people not to do it. It's worse when there is a question on stackoverflow.com and not even a reference to it since we may expend effort here when someone else is already helping.

@haydin505
Copy link

@philwebb Sorry for the inconvenience. For later cases I will only create questions on Stack Overflow and not ask anything on GitHub.

@philwebb
Copy link
Member Author

philwebb commented Jun 6, 2023

Thanks @haydin505! FWIW I posted an answer that I hope helps.

groldan added a commit to groldan/geoserver-cloud that referenced this issue Aug 3, 2023
technical debt: annotate auto configuration classes with
spring-boot's `@AutoConfiguration` instead of spring's `@Configuration`.

`@AutoConfiguration` was introduced in 2.7 with the idea to
mark all auto-configurations with its dedicated annotation
and move away from spring.factories for auto-configuration
imports in 3.0 as described in this
[Github issue](spring-projects/spring-boot#29698).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another type: epic An issue tracking a large piece of work that will be split into smaller issues
Projects
None yet
Development

No branches or pull requests

4 participants