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

Add API counterpart for handling Fallback and 'defaultCandidate=false' beans #34203

Open
snicoll opened this issue Jan 7, 2025 · 0 comments
Open
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@snicoll
Copy link
Member

snicoll commented Jan 7, 2025

Spring Framework 6.2 has introduced a new type of beans using @Fallback, which complements the existing @Bean(defaultCandidate=false) and this issue is about introducing an API counterpart that would allow one to handle such beans without relying on the BeanFactory.

Spring Boot is using ObjectProvider with convenience method to sort beans according to their order. This abstraction cannot be used as it mimics the behavior of autowiring-by-type. A similar API where we'd be able to continue using the sorting algorithm would be much more welcome.

Our current workaround would be to use this.beanFactory.getBeansOfType(beanType, false, false) but this requires to inject the BeanFactory in infrastructure code that didn't need it previously.

@snicoll snicoll added the type: enhancement A general enhancement label Jan 7, 2025
@snicoll snicoll added this to the 6.2.2 milestone Jan 7, 2025
@snicoll snicoll changed the title Add API counterpart for handling Fallback beans Add API counterpart for handling Fallback and 'defaultCandidate=false' beans Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants