Skip to content

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

Closed
@snicoll

Description

@snicoll

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.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions