AutowireCandidateResolver implementation that matches bean definition qualifiers
against qualifier annotations on the field or parameter to be autowired.
Also supports suggested expression values through a value annotation.
Also supports JSR-330's jakarta. annotation, if available.
AutowireCandidateQualifier, Qualifier, Value
| Modifier and Type | Field and Description |
|---|---|
| private final Set | |
| private Class |
| Access | Constructor and Description |
|---|---|
| public | QualifierAnnotationAutowireCandidateResolver()
Create a new QualifierAnnotationAutowireCandidateResolver
for Spring's standard |
| public | QualifierAnnotationAutowireCandidateResolver(Class<? extends Annotation>
the qualifier annotation to look for qualifierType)Create a new QualifierAnnotationAutowireCandidateResolver for the given qualifier annotation type. |
| public | QualifierAnnotationAutowireCandidateResolver(Set<Class<? extends Annotation>>
the qualifier annotations to look for qualifierTypes)Create a new QualifierAnnotationAutowireCandidateResolver for the given qualifier annotation types. |
| Modifier and Type | Method and Description |
|---|---|
| public void | addQualifierType(Class<? extends Annotation>
the annotation type to register qualifierType)Register the given type to be used as a qualifier when autowiring. |
| protected boolean | checkQualifier(BeanDefinitionHolder bdHolder, Annotation annotation, TypeConverter typeConverter)
Match the given qualifier annotation against the candidate bean definition. |
| protected boolean | checkQualifiers(BeanDefinitionHolder bdHolder, Annotation[] annotationsToSearch)
Match the given qualifier annotations against the candidate bean definition. |
| protected Object | |
| protected Object | findValue(Annotation[] annotationsToSearch)
Determine a suggested value from any of the given candidate annotations. |
| protected Annotation | |
| protected Annotation | |
| public Object | getSuggestedValue(DependencyDescriptor
the descriptor for the target method parameter or field descriptor)Overrides org. Overrides default org. |
| public boolean | hasQualifier(DependencyDescriptor
the descriptor for the target method parameter or field descriptor)Overrides org. Overrides default org. |
| public boolean | isAutowireCandidate(BeanDefinitionHolder
the bean definition including bean name and aliases bdHolder, DependencyDescriptor the descriptor for the target method parameter or field descriptor)
Overrides default org. |
| protected boolean | isQualifier(Class<? extends Annotation> annotationType)
Checks whether the given annotation type is a recognized qualifier type. |
| public boolean | isRequired(DependencyDescriptor
the descriptor for the target method parameter or field descriptor)Overrides org. Overrides default org. |
| public void | setValueAnnotationType(Class<? extends Annotation> valueAnnotationType)
Set the 'value' annotation type, to be used on fields, method parameters and constructor parameters. |
| qualifierTypes | back to summary |
|---|---|
| private final Set<Class<? extends Annotation>> qualifierTypes | |
| valueAnnotationType | back to summary |
|---|---|
| private Class<? extends Annotation> valueAnnotationType | |
| QualifierAnnotationAutowireCandidateResolver | back to summary |
|---|---|
| public QualifierAnnotationAutowireCandidateResolver() Create a new QualifierAnnotationAutowireCandidateResolver
for Spring's standard Also supports JSR-330's
| |
| QualifierAnnotationAutowireCandidateResolver | back to summary |
|---|---|
| public QualifierAnnotationAutowireCandidateResolver(Class<? extends Annotation> qualifierType) Create a new QualifierAnnotationAutowireCandidateResolver for the given qualifier annotation type.
| |
| QualifierAnnotationAutowireCandidateResolver | back to summary |
|---|---|
| public QualifierAnnotationAutowireCandidateResolver(Set<Class<? extends Annotation>> qualifierTypes) Create a new QualifierAnnotationAutowireCandidateResolver for the given qualifier annotation types.
| |
| addQualifierType | back to summary |
|---|---|
| public void addQualifierType(Class<? extends Annotation> qualifierType) Register the given type to be used as a qualifier when autowiring. This identifies qualifier annotations for direct use (on fields, method parameters and constructor parameters) as well as meta annotations that in turn identify actual qualifier annotations. This implementation only supports annotations as qualifier types.
The default is Spring's
| |
| checkQualifier | back to summary |
|---|---|
| protected boolean checkQualifier(BeanDefinitionHolder bdHolder, Annotation annotation, TypeConverter typeConverter) Match the given qualifier annotation against the candidate bean definition. | |
| checkQualifiers | back to summary |
|---|---|
| protected boolean checkQualifiers(BeanDefinitionHolder bdHolder, Annotation[] annotationsToSearch) Match the given qualifier annotations against the candidate bean definition. | |
| extractValue | back to summary |
|---|---|
| protected Object extractValue(AnnotationAttributes attr) Extract the value attribute from the given annotation.
| |
| findValue | back to summary |
|---|---|
| protected Object findValue(Annotation[] annotationsToSearch) Determine a suggested value from any of the given candidate annotations.
| |
| getFactoryMethodAnnotation | back to summary |
|---|---|
protected Annotation getFactoryMethodAnnotation(RootBeanDefinition bd, Class<? extends Annotation> type)
| |
| getQualifiedElementAnnotation | back to summary |
|---|---|
protected Annotation getQualifiedElementAnnotation(RootBeanDefinition bd, Class<? extends Annotation> type)
| |
| getSuggestedValue | back to summary |
|---|---|
| public Object getSuggestedValue(DependencyDescriptor descriptor) Overrides org. Overrides default org. Determine whether the given dependency declares a value annotation.
| |
| hasQualifier | back to summary |
|---|---|
| public boolean hasQualifier(DependencyDescriptor descriptor) Overrides org. Overrides default org. Determine whether the given dependency declares a qualifier annotation.
| |
| isAutowireCandidate | back to summary |
|---|---|
| public boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) Overrides default org. Determine whether the provided bean definition is an autowire candidate. To be considered a candidate the bean's autowire-candidate attribute must not have been set to 'false'. Also, if an annotation on the field or parameter to be autowired is recognized by this bean factory as a qualifier, the bean must 'match' against the annotation as well as any attributes it may contain. The bean definition must contain the same qualifier or match by meta attributes. A "value" attribute will fall back to match against the bean name or an alias if a qualifier or attribute does not match.
| |
| isQualifier | back to summary |
|---|---|
| protected boolean isQualifier(Class<? extends Annotation> annotationType) Checks whether the given annotation type is a recognized qualifier type. | |
| isRequired | back to summary |
|---|---|
| public boolean isRequired(DependencyDescriptor descriptor) Overrides org. Overrides default org. Determine whether the given dependency declares an autowired annotation, checking its required flag.
| |
| setValueAnnotationType | back to summary |
|---|---|
| public void setValueAnnotationType(Class<? extends Annotation> valueAnnotationType) Set the 'value' annotation type, to be used on fields, method parameters and constructor parameters. The default value annotation type is the Spring-provided
This setter property exists so that developers can provide their own (non-Spring-specific) annotation type to indicate a default value expression for a specific argument. | |