Closed
Description
Lari Hotari opened SPR-12147 and commented
Spring currently doesn't have a public API for finding beans based on generics type information. Generic types seem to only be supported in autowiring fields or methods (Spring blog article).
There is a discussion about this feature in the issue comments of SPR-9965 .
I'd like to have generics support in ListableBeanFactory:
String[] getBeanNamesForType(ResolvableType resolvableType);
<T> Map<String, T> getBeansOfType(Class<T> type, ResolvableType resolvableType) throws BeansException;
<T> Map<String, T> getBeansOfType(Class<T> type, ResolvableType resolvableType, boolean includeNonSingletons, boolean allowEagerInit) throws BeansException;
Affects: 4.0.6, 4.1 RC2
Issue Links:
- Autowiring of generic types [SPR-9965] #14599 Autowiring of generic types
- Support dynamic bean lookup a la CDI's Instance type [SPR-13132] #17723 Support dynamic bean lookup a la CDI's Instance type
- Programmatic ObjectProvider retrieval through BeanFactory API [SPR-17075] #21613 Programmatic ObjectProvider retrieval through BeanFactory API
- getBeanNamesForType(ResolvableType) does not reliably work for beans with AOP proxies [SPR-14097] #18669 getBeanNamesForType(ResolvableType) does not reliably work for beans with AOP proxies
- getBeanNamesForType(ResolvableType) doesn't match generic factory method return type for yet-to-be-created bean [SPR-15011] #19578 getBeanNamesForType(ResolvableType) doesn't match generic factory method return type for yet-to-be-created bean
Referenced from: commits b230892, 778a019
0 votes, 11 watchers