Class SimpleAutowireCandidateResolver
java.lang.Object
org.springframework.beans.factory.support.SimpleAutowireCandidateResolver
- All Implemented Interfaces:
AutowireCandidateResolver
- Direct Known Subclasses:
GenericTypeAwareAutowireCandidateResolver
AutowireCandidateResolver
implementation to use when no annotation
support is available. This implementation checks the bean definition only.- Since:
- 2.5
- Author:
- Mark Fisher, Juergen Hoeller
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SimpleAutowireCandidateResolver
Shared instance ofSimpleAutowireCandidateResolver
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis implementation returnsthis
as-is.resolveAutowireCandidates
(ConfigurableListableBeanFactory lbf, Class<T> type) Resolve a map of all beans of the given type, also picking up beans defined in ancestor bean factories, with the specific condition that each bean actually has autowire candidate status.resolveAutowireCandidates
(ConfigurableListableBeanFactory lbf, Class<T> type, boolean includeNonSingletons, boolean allowEagerInit) Resolve a map of all beans of the given type, also picking up beans defined in ancestor bean factories, with the specific condition that each bean actually has autowire candidate status.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.beans.factory.support.AutowireCandidateResolver
getLazyResolutionProxyClass, getLazyResolutionProxyIfNecessary, getSuggestedName, getSuggestedValue, hasQualifier, isAutowireCandidate, isRequired
-
Field Details
-
INSTANCE
Shared instance ofSimpleAutowireCandidateResolver
.- Since:
- 5.2.7
-
-
Constructor Details
-
SimpleAutowireCandidateResolver
public SimpleAutowireCandidateResolver()
-
-
Method Details
-
cloneIfNecessary
This implementation returnsthis
as-is.- Specified by:
cloneIfNecessary
in interfaceAutowireCandidateResolver
- See Also:
-
resolveAutowireCandidates
public static <T> Map<String,T> resolveAutowireCandidates(ConfigurableListableBeanFactory lbf, Class<T> type) Resolve a map of all beans of the given type, also picking up beans defined in ancestor bean factories, with the specific condition that each bean actually has autowire candidate status. This matches simple injection point resolution as implemented by thisAutowireCandidateResolver
strategy, including beans which are not marked as default candidates but excluding beans which are not even marked as autowire candidates.- Parameters:
lbf
- the bean factorytype
- the type of bean to match- Returns:
- the Map of matching bean instances, or an empty Map if none
- Throws:
BeansException
- if a bean could not be created- Since:
- 6.2.3
- See Also:
-
resolveAutowireCandidates
public static <T> Map<String,T> resolveAutowireCandidates(ConfigurableListableBeanFactory lbf, Class<T> type, boolean includeNonSingletons, boolean allowEagerInit) Resolve a map of all beans of the given type, also picking up beans defined in ancestor bean factories, with the specific condition that each bean actually has autowire candidate status. This matches simple injection point resolution as implemented by thisAutowireCandidateResolver
strategy, including beans which are not marked as default candidates but excluding beans which are not even marked as autowire candidates.- Parameters:
lbf
- the bean factorytype
- the type of bean to matchincludeNonSingletons
- whether to include prototype or scoped beans too or just singletons (also applies to FactoryBeans)allowEagerInit
- whether to initialize lazy-init singletons and objects created by FactoryBeans (or by factory methods with a "factory-bean" reference) for the type check. Note that FactoryBeans need to be eagerly initialized to determine their type: So be aware that passing in "true" for this flag will initialize FactoryBeans and "factory-bean" references.- Returns:
- the Map of matching bean instances, or an empty Map if none
- Throws:
BeansException
- if a bean could not be created- Since:
- 6.2.5
- See Also:
-