Class GenericTypeAwareAutowireCandidateResolver
java.lang.Object
org.springframework.beans.factory.support.SimpleAutowireCandidateResolver
org.springframework.beans.factory.support.GenericTypeAwareAutowireCandidateResolver
- All Implemented Interfaces:
Cloneable
,Aware
,BeanFactoryAware
,AutowireCandidateResolver
- Direct Known Subclasses:
QualifierAnnotationAutowireCandidateResolver
public class GenericTypeAwareAutowireCandidateResolver
extends SimpleAutowireCandidateResolver
implements BeanFactoryAware, Cloneable
Basic
AutowireCandidateResolver
that performs a full generic type
match with the candidate's type if the dependency is declared as a generic type
(e.g. Repository<Customer>
).
This is the base class for
QualifierAnnotationAutowireCandidateResolver
,
providing an implementation all non-annotation-based resolution steps at this level.
- Since:
- 4.0
- Author:
- Juergen Hoeller
-
Field Summary
Fields inherited from class org.springframework.beans.factory.support.SimpleAutowireCandidateResolver
INSTANCE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
checkGenericTypeMatch
(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) Match the given dependency type with its generic type information against the given candidate bean definition.This implementation clones all instance fields through standardCloneable
support, allowing for subsequent reconfiguration of the cloned instance through a freshsetBeanFactory(org.springframework.beans.factory.BeanFactory)
call.protected final BeanFactory
protected RootBeanDefinition
protected ResolvableType
getReturnTypeForFactoryMethod
(RootBeanDefinition rbd, DependencyDescriptor descriptor) boolean
isAutowireCandidate
(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) Determine whether the given bean definition qualifies as an autowire candidate for the given dependency.void
setBeanFactory
(BeanFactory beanFactory) Callback that supplies the owning factory to a bean instance.Methods inherited from class org.springframework.beans.factory.support.SimpleAutowireCandidateResolver
getLazyResolutionProxyClass, getLazyResolutionProxyIfNecessary, getSuggestedValue, hasQualifier, isRequired
-
Constructor Details
-
GenericTypeAwareAutowireCandidateResolver
public GenericTypeAwareAutowireCandidateResolver()
-
-
Method Details
-
setBeanFactory
Description copied from interface:BeanFactoryAware
Callback that supplies the owning factory to a bean instance.Invoked after the population of normal bean properties but before an initialization callback such as
InitializingBean.afterPropertiesSet()
or a custom init-method.- Specified by:
setBeanFactory
in interfaceBeanFactoryAware
- Parameters:
beanFactory
- owning BeanFactory (nevernull
). The bean can immediately call methods on the factory.- See Also:
-
getBeanFactory
-
isAutowireCandidate
Description copied from interface:AutowireCandidateResolver
Determine whether the given bean definition qualifies as an autowire candidate for the given dependency.The default implementation checks
BeanDefinition.isAutowireCandidate()
.- Specified by:
isAutowireCandidate
in interfaceAutowireCandidateResolver
- Overrides:
isAutowireCandidate
in classSimpleAutowireCandidateResolver
- Parameters:
bdHolder
- the bean definition including bean name and aliasesdescriptor
- the descriptor for the target method parameter or field- Returns:
- whether the bean definition qualifies as autowire candidate
- See Also:
-
checkGenericTypeMatch
protected boolean checkGenericTypeMatch(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) Match the given dependency type with its generic type information against the given candidate bean definition. -
getResolvedDecoratedDefinition
-
getReturnTypeForFactoryMethod
@Nullable protected ResolvableType getReturnTypeForFactoryMethod(RootBeanDefinition rbd, DependencyDescriptor descriptor) -
cloneIfNecessary
This implementation clones all instance fields through standardCloneable
support, allowing for subsequent reconfiguration of the cloned instance through a freshsetBeanFactory(org.springframework.beans.factory.BeanFactory)
call.- Specified by:
cloneIfNecessary
in interfaceAutowireCandidateResolver
- Overrides:
cloneIfNecessary
in classSimpleAutowireCandidateResolver
- See Also:
-