AnnotatedGenericBeanDefinition (Spring Framework 3.2.1.RELEASE API)
Date: 2013-01-24

org.springframework.beans.factory.annotation

## Class AnnotatedGenericBeanDefinition

- java.lang.Object
- - org.springframework.core.AttributeAccessorSupport
  - - org.springframework.beans.BeanMetadataAttributeAccessor
    - - org.springframework.beans.factory.support.AbstractBeanDefinition
      - - org.springframework.beans.factory.support.GenericBeanDefinition
        - - org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition

- All Implemented Interfaces:
    Serializable, Cloneable, BeanMetadataElement, AnnotatedBeanDefinition, BeanDefinition, 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 `ScannedGenericBeanDefinition`, which also implements the AnnotatedBeanDefinition interface).

  Since:
    2.5
  Author:
    Juergen Hoeller, Chris Beams
  See Also:
    `AnnotatedBeanDefinition.getMetadata()`, `StandardAnnotationMetadata`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.springframework.beans.factory.support.AbstractBeanDefinition

      `AUTOWIRE_AUTODETECT, AUTOWIRE_BY_NAME, AUTOWIRE_BY_TYPE, AUTOWIRE_CONSTRUCTOR, AUTOWIRE_NO, DEPENDENCY_CHECK_ALL, DEPENDENCY_CHECK_NONE, DEPENDENCY_CHECK_OBJECTS, DEPENDENCY_CHECK_SIMPLE, INFER_METHOD, SCOPE_DEFAULT`

    - ### Fields inherited from interface org.springframework.beans.factory.config.BeanDefinition

      `ROLE_APPLICATION, ROLE_INFRASTRUCTURE, ROLE_SUPPORT, SCOPE_PROTOTYPE, SCOPE_SINGLETON`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AnnotatedGenericBeanDefinition(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.
    `AnnotatedGenericBeanDefinition(Class<?> beanClass)` Create a new AnnotatedGenericBeanDefinition for the given bean class.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `AnnotationMetadata` | `getMetadata()` Obtain the annotation metadata (as well as basic class metadata) for this bean definition's bean class.

    - ### Methods inherited from class org.springframework.beans.factory.support.GenericBeanDefinition

      `cloneBeanDefinition, equals, getParentName, setParentName, toString`

    - ### Methods inherited from class org.springframework.beans.factory.support.AbstractBeanDefinition

      `addQualifier, applyDefaults, clone, copyQualifiersFrom, getAutowireMode, getBeanClass, getBeanClassName, getConstructorArgumentValues, getDependencyCheck, getDependsOn, getDescription, getDestroyMethodName, getFactoryBeanName, getFactoryMethodName, getInitMethodName, getMethodOverrides, getOriginatingBeanDefinition, getPropertyValues, getQualifier, getQualifiers, getResolvedAutowireMode, getResource, getResourceDescription, getRole, getScope, hasBeanClass, hasConstructorArgumentValues, hashCode, hasQualifier, isAbstract, isAutowireCandidate, isEnforceDestroyMethod, isEnforceInitMethod, isLazyInit, isLenientConstructorResolution, isNonPublicAccessAllowed, isPrimary, isPrototype, isSingleton, isSynthetic, overrideFrom, overrideFrom, prepareMethodOverride, prepareMethodOverrides, resolveBeanClass, setAbstract, setAutowireCandidate, setAutowireMode, setBeanClass, setBeanClassName, setConstructorArgumentValues, setDependencyCheck, setDependsOn, setDescription, setDestroyMethodName, setEnforceDestroyMethod, setEnforceInitMethod, setFactoryBeanName, setFactoryMethodName, setInitMethodName, setLazyInit, setLenientConstructorResolution, setMethodOverrides, setNonPublicAccessAllowed, setOriginatingBeanDefinition, setPrimary, setPropertyValues, setResource, setResourceDescription, setRole, setScope, setSingleton, setSynthetic, validate`

    - ### Methods inherited from class org.springframework.beans.BeanMetadataAttributeAccessor

      `addMetadataAttribute, getAttribute, getMetadataAttribute, getSource, removeAttribute, setAttribute, setSource`

    - ### Methods inherited from class org.springframework.core.AttributeAccessorSupport

      `attributeNames, copyAttributesFrom, hasAttribute`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.springframework.beans.factory.config.BeanDefinition

      `getBeanClassName, getConstructorArgumentValues, getDependsOn, getDescription, getFactoryBeanName, getFactoryMethodName, getOriginatingBeanDefinition, getParentName, getPropertyValues, getResourceDescription, getRole, getScope, isAbstract, isAutowireCandidate, isLazyInit, isPrimary, isPrototype, isSingleton, setAutowireCandidate, setBeanClassName, setDependsOn, setFactoryBeanName, setFactoryMethodName, setLazyInit, setParentName, setPrimary, setScope`

    - ### Methods inherited from interface org.springframework.core.AttributeAccessor

      `attributeNames, getAttribute, hasAttribute, removeAttribute, setAttribute`

    - ### Methods inherited from interface org.springframework.beans.BeanMetadataElement

      `getSource`

- - ### Constructor Detail

    - #### AnnotatedGenericBeanDefinition

          public AnnotatedGenericBeanDefinition(Class<?> beanClass)

      Create a new AnnotatedGenericBeanDefinition for the given bean class.
      Parameters:
        `beanClass` - the loaded bean class

    - #### AnnotatedGenericBeanDefinition

          public AnnotatedGenericBeanDefinition(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

  - ### Method Detail

    - #### getMetadata

          public final 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`)