Class AnnotatedGenericBeanDefinition

All Implemented Interfaces:
Serializable, Cloneable, BeanMetadataElement, AnnotatedBeanDefinition, BeanDefinition, org.springframework.core.AttributeAccessor

public class AnnotatedGenericBeanDefinition extends GenericBeanDefinition implements AnnotatedBeanDefinition
Extension of the GenericBeanDefinition class, adding support for annotation metadata exposed through the AnnotatedBeanDefinition interface.

This GenericBeanDefinition variant is mainly useful for testing code that expects to operate on an AnnotatedBeanDefinition, for example strategy implementations in Spring's component scanning support (where the default definition class is org.springframework.context.annotation.ScannedGenericBeanDefinition, which also implements the AnnotatedBeanDefinition interface).

Since:
2.5
Author:
Juergen Hoeller, Chris Beams
See Also:
  • Constructor Details

    • AnnotatedGenericBeanDefinition

      public AnnotatedGenericBeanDefinition(Class<?> beanClass)
      Create a new AnnotatedGenericBeanDefinition for the given bean class.
      Parameters:
      beanClass - the loaded bean class
    • AnnotatedGenericBeanDefinition

      public AnnotatedGenericBeanDefinition(org.springframework.core.type.AnnotationMetadata metadata)
      Create a new AnnotatedGenericBeanDefinition for the given annotation metadata, allowing for ASM-based processing and avoidance of early loading of the bean class. Note that this constructor is functionally equivalent to ScannedGenericBeanDefinition, however the semantics of the latter indicate that a bean was discovered specifically via component-scanning as opposed to other means.
      Parameters:
      metadata - the annotation metadata for the bean class in question
      Since:
      3.1.1
    • AnnotatedGenericBeanDefinition

      public AnnotatedGenericBeanDefinition(org.springframework.core.type.AnnotationMetadata metadata, org.springframework.core.type.MethodMetadata factoryMethodMetadata)
      Create a new AnnotatedGenericBeanDefinition for the given annotation metadata, based on an annotated class and a factory method on that class.
      Parameters:
      metadata - the annotation metadata for the bean class in question
      factoryMethodMetadata - metadata for the selected factory method
      Since:
      4.1.1
  • Method Details

    • getMetadata

      public final org.springframework.core.type.AnnotationMetadata getMetadata()
      Description copied from interface: AnnotatedBeanDefinition
      Obtain the annotation metadata (as well as basic class metadata) for this bean definition's bean class.
      Specified by:
      getMetadata in interface AnnotatedBeanDefinition
      Returns:
      the annotation metadata object (never null)
    • getFactoryMethodMetadata

      @Nullable public final org.springframework.core.type.MethodMetadata getFactoryMethodMetadata()
      Description copied from interface: AnnotatedBeanDefinition
      Obtain metadata for this bean definition's factory method, if any.
      Specified by:
      getFactoryMethodMetadata in interface AnnotatedBeanDefinition
      Returns:
      the factory method metadata, or null if none