Top Description Methods
org.springframework.beans.factory.support

public Interface AutowireCandidateResolver

Known Direct Implementers
org.springframework.beans.factory.support.SimpleAutowireCandidateResolver
Imports
org.springframework.beans.BeanUtils, org.springframework.beans.factory.config.BeanDefinitionHolder, .DependencyDescriptor, org.springframework.lang.Nullable

Strategy interface for determining whether a specific bean definition qualifies as an autowire candidate for a specific dependency.
Authors
Juergen Hoeller, Mark Fisher
Since
2.5

Method Summary

Modifier and TypeMethod and Description
public default AutowireCandidateResolver
cloneIfNecessary()

Return a clone of this resolver instance if necessary, retaining its local configuration and allowing for the cloned instance to get associated with a new bean factory, or this original instance if there is no such state.

public default Class<?>

Returns:

the lazy resolution proxy class for the dependency target, if any
getLazyResolutionProxyClass
(DependencyDescriptor
the descriptor for the target method parameter or field
descriptor
,
String
the name of the bean that contains the injection point
beanName
)

Determine the proxy class for lazy resolution of the dependency target, if demanded by the injection point.

public default Object

Returns:

the lazy resolution proxy for the actual dependency target, or null if straight resolution is to be performed
getLazyResolutionProxyIfNecessary
(DependencyDescriptor
the descriptor for the target method parameter or field
descriptor
,
String
the name of the bean that contains the injection point
beanName
)

Build a proxy for lazy resolution of the actual dependency target, if demanded by the injection point.

public default Object

Returns:

the value suggested (typically an expression String), or null if none found
getSuggestedValue
(DependencyDescriptor
the descriptor for the target method parameter or field
descriptor
)

Determine whether a default value is suggested for the given dependency.

public default boolean

Returns:

whether the descriptor declares a qualifier, narrowing the candidate status beyond the type match
hasQualifier
(DependencyDescriptor
the descriptor for the target method parameter or field
descriptor
)

Determine whether the given descriptor declares a qualifier beyond the type (typically - but not necessarily - a specific kind of annotation).

public default boolean

Returns:

whether the bean definition qualifies as autowire candidate
isAutowireCandidate
(BeanDefinitionHolder
the bean definition including bean name and aliases
bdHolder
,
DependencyDescriptor
the descriptor for the target method parameter or field
descriptor
)

Determine whether the given bean definition qualifies as an autowire candidate for the given dependency.

public default boolean

Returns:

whether the descriptor is marked as required or possibly indicating non-required status some other way (e.g. through a parameter annotation)
isRequired
(DependencyDescriptor
the descriptor for the target method parameter or field
descriptor
)

Determine whether the given descriptor is effectively required.

Method Detail

cloneIfNecessaryback to summary
public default AutowireCandidateResolver cloneIfNecessary()

Return a clone of this resolver instance if necessary, retaining its local configuration and allowing for the cloned instance to get associated with a new bean factory, or this original instance if there is no such state.

The default implementation creates a separate instance via the default class constructor, assuming no specific configuration state to copy. Subclasses may override this with custom configuration state handling or with standard Cloneable support (as implemented by Spring's own configurable AutowireCandidateResolver variants), or simply return this (as in SimpleAutowireCandidateResolver).

Since
5.2.7
See Also
GenericTypeAwareAutowireCandidateResolver#cloneIfNecessary(), DefaultListableBeanFactory#copyConfigurationFrom
getLazyResolutionProxyClassback to summary
public default Class<?> getLazyResolutionProxyClass(DependencyDescriptor descriptor, String beanName)

Determine the proxy class for lazy resolution of the dependency target, if demanded by the injection point.

The default implementation simply returns null.

Parameters
descriptor:DependencyDescriptor

the descriptor for the target method parameter or field

beanName:String

the name of the bean that contains the injection point

Returns:Class<?>

the lazy resolution proxy class for the dependency target, if any

Annotations
@Nullable
Since
6.0
getLazyResolutionProxyIfNecessaryback to summary
public default Object getLazyResolutionProxyIfNecessary(DependencyDescriptor descriptor, String beanName)

Build a proxy for lazy resolution of the actual dependency target, if demanded by the injection point.

The default implementation simply returns null.

Parameters
descriptor:DependencyDescriptor

the descriptor for the target method parameter or field

beanName:String

the name of the bean that contains the injection point

Returns:Object

the lazy resolution proxy for the actual dependency target, or null if straight resolution is to be performed

Annotations
@Nullable
Since
4.0
getSuggestedValueback to summary
public default Object getSuggestedValue(DependencyDescriptor descriptor)

Determine whether a default value is suggested for the given dependency.

The default implementation simply returns null.

Parameters
descriptor:DependencyDescriptor

the descriptor for the target method parameter or field

Returns:Object

the value suggested (typically an expression String), or null if none found

Annotations
@Nullable
Since
3.0
hasQualifierback to summary
public default boolean hasQualifier(DependencyDescriptor descriptor)

Determine whether the given descriptor declares a qualifier beyond the type (typically - but not necessarily - a specific kind of annotation).

The default implementation returns false.

Parameters
descriptor:DependencyDescriptor

the descriptor for the target method parameter or field

Returns:boolean

whether the descriptor declares a qualifier, narrowing the candidate status beyond the type match

Since
5.1
See Also
org.springframework.beans.factory.annotation.QualifierAnnotationAutowireCandidateResolver#hasQualifier
isAutowireCandidateback to summary
public default boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor)

Determine whether the given bean definition qualifies as an autowire candidate for the given dependency.

The default implementation checks org.springframework.beans.factory.config.BeanDefinition#isAutowireCandidate().

Parameters
bdHolder:BeanDefinitionHolder

the bean definition including bean name and aliases

descriptor:DependencyDescriptor

the descriptor for the target method parameter or field

Returns:boolean

whether the bean definition qualifies as autowire candidate

See Also
org.springframework.beans.factory.config.BeanDefinition#isAutowireCandidate()
isRequiredback to summary
public default boolean isRequired(DependencyDescriptor descriptor)

Determine whether the given descriptor is effectively required.

The default implementation checks DependencyDescriptor#isRequired().

Parameters
descriptor:DependencyDescriptor

the descriptor for the target method parameter or field

Returns:boolean

whether the descriptor is marked as required or possibly indicating non-required status some other way (e.g. through a parameter annotation)

Since
5.0
See Also
DependencyDescriptor#isRequired()