Add API counterpart for handling Fallback and 'defaultCandidate=false' beans #34203
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
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 theBeanFactory
.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 theBeanFactory
in infrastructure code that didn't need it previously.The text was updated successfully, but these errors were encountered: