public class GenericTypeAwareAutowireCandidateResolver extends SimpleAutowireCandidateResolver implements BeanFactoryAware, Cloneable
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.
INSTANCE
Constructor and Description |
---|
GenericTypeAwareAutowireCandidateResolver() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkGenericTypeMatch(BeanDefinitionHolder bdHolder,
DependencyDescriptor descriptor)
Match the given dependency type with its generic type information against the given
candidate bean definition.
|
AutowireCandidateResolver |
cloneIfNecessary()
This implementation clones all instance fields through standard
Cloneable support, allowing for subsequent reconfiguration
of the cloned instance through a fresh setBeanFactory(org.springframework.beans.factory.BeanFactory) call. |
protected BeanFactory |
getBeanFactory() |
protected RootBeanDefinition |
getResolvedDecoratedDefinition(RootBeanDefinition rbd) |
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.
|
getLazyResolutionProxyIfNecessary, getSuggestedValue, hasQualifier, isRequired
public GenericTypeAwareAutowireCandidateResolver()
public void setBeanFactory(BeanFactory beanFactory)
BeanFactoryAware
Invoked after the population of normal bean properties
but before an initialization callback such as
InitializingBean.afterPropertiesSet()
or a custom init-method.
setBeanFactory
in interface BeanFactoryAware
beanFactory
- owning BeanFactory (never null
).
The bean can immediately call methods on the factory.BeanInitializationException
@Nullable protected final BeanFactory getBeanFactory()
public boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor)
AutowireCandidateResolver
The default implementation checks
BeanDefinition.isAutowireCandidate()
.
isAutowireCandidate
in interface AutowireCandidateResolver
isAutowireCandidate
in class SimpleAutowireCandidateResolver
bdHolder
- the bean definition including bean name and aliasesdescriptor
- the descriptor for the target method parameter or fieldBeanDefinition.isAutowireCandidate()
protected boolean checkGenericTypeMatch(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor)
@Nullable protected RootBeanDefinition getResolvedDecoratedDefinition(RootBeanDefinition rbd)
@Nullable protected ResolvableType getReturnTypeForFactoryMethod(RootBeanDefinition rbd, DependencyDescriptor descriptor)
public AutowireCandidateResolver cloneIfNecessary()
Cloneable
support, allowing for subsequent reconfiguration
of the cloned instance through a fresh setBeanFactory(org.springframework.beans.factory.BeanFactory)
call.cloneIfNecessary
in interface AutowireCandidateResolver
cloneIfNecessary
in class SimpleAutowireCandidateResolver
Object.clone()