Allow filtering bean instances returned by ObjectProvider.stream()
#34318
Labels
status: waiting-for-triage
An issue we've not yet triaged or decided on
The implementations of
ObjectProvider.stream()
look up all bean names for the type referenced and subsequently look up the bean instance itself. This means that a call to….stream()
ultimately causes all bean instances to be initialized. It would be nice if there was a way to be selective about which of those instances I want to get by being able to filter on the bean name before instantiation.My particular use case is to exclude beans of a particular type, so the filter being a
BiPredicate<String, Class<?>>
would prevent my code from having to obtain a reference to aBeanFactory
to obtain the bean definition's type. That said, a simplestream(Predicate<String> beanNameFilter)
would work as well.The text was updated successfully, but these errors were encountered: