org.springframework.beans.factory.support

## Class GenericTypeAwareAutowireCandidateResolver

- java.lang.Object
- - org.springframework.beans.factory.support.GenericTypeAwareAutowireCandidateResolver

- All Implemented Interfaces:
    Aware, BeanFactoryAware, AutowireCandidateResolver
  Direct Known Subclasses:
    QualifierAnnotationAutowireCandidateResolver

      public class GenericTypeAwareAutowireCandidateResolver
      extends Object
      implements AutowireCandidateResolver, BeanFactoryAware

  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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GenericTypeAwareAutowireCandidateResolver()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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.
    `protected BeanFactory` | `getBeanFactory()`
    `Object` | `getLazyResolutionProxyIfNecessary(DependencyDescriptor descriptor, String beanName)` This implementation always returns `null`, leaving lazy resolution support up to subclasses.
    `protected RootBeanDefinition` | `getResolvedDecoratedDefinition(RootBeanDefinition rbd)`
    `protected ResolvableType` | `getReturnTypeForFactoryMethod(RootBeanDefinition rbd, DependencyDescriptor descriptor)`
    `Object` | `getSuggestedValue(DependencyDescriptor descriptor)` This implementation always returns `null`, leaving suggested value support up to subclasses.
    `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 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GenericTypeAwareAutowireCandidateResolver

          public GenericTypeAwareAutowireCandidateResolver()

  - ### Method Detail

    - #### setBeanFactory

          public void setBeanFactory(BeanFactory beanFactory)

      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 interface `BeanFactoryAware`
      Parameters:
        `beanFactory` - owning BeanFactory (never `null`). The bean can immediately call methods on the factory.
      See Also:
        `BeanInitializationException`

    - #### getBeanFactory

          protected final BeanFactory getBeanFactory()

    - #### isAutowireCandidate

          public boolean isAutowireCandidate(BeanDefinitionHolder bdHolder,
                                             DependencyDescriptor descriptor)

      Description copied from interface: `AutowireCandidateResolver`
      Determine whether the given bean definition qualifies as an autowire candidate for the given dependency.
      Specified by:
        `isAutowireCandidate` in interface `AutowireCandidateResolver`
      Parameters:
        `bdHolder` - the bean definition including bean name and aliases
        `descriptor` - the descriptor for the target method parameter or field
      Returns:
        whether the bean definition qualifies as autowire candidate

    - #### 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

          protected RootBeanDefinition getResolvedDecoratedDefinition(RootBeanDefinition rbd)

    - #### getReturnTypeForFactoryMethod

          protected ResolvableType getReturnTypeForFactoryMethod(RootBeanDefinition rbd,
                                                                 DependencyDescriptor descriptor)

    - #### getSuggestedValue

          public Object getSuggestedValue(DependencyDescriptor descriptor)

      This implementation always returns `null`, leaving suggested value support up to subclasses.
      Specified by:
        `getSuggestedValue` in interface `AutowireCandidateResolver`
      Parameters:
        `descriptor` - the descriptor for the target method parameter or field
      Returns:
        the value suggested (typically an expression String), or `null` if none found

    - #### getLazyResolutionProxyIfNecessary

          public Object getLazyResolutionProxyIfNecessary(DependencyDescriptor descriptor,
                                                          String beanName)

      This implementation always returns `null`, leaving lazy resolution support up to subclasses.
      Specified by:
        `getLazyResolutionProxyIfNecessary` in interface `AutowireCandidateResolver`
      Parameters:
        `descriptor` - the descriptor for the target method parameter or field
        `beanName` - the name of the bean that contains the injection point
      Returns:
        the lazy resolution proxy for the actual dependency target, or `null` if straight resolution is to be performed