Closed
Description
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 a BeanFactory
to obtain the bean definition's type. That said, a simple stream(Predicate<String> beanNameFilter)
would work as well.