spring-framework / org.springframework.beans.factory.annotation / AnnotatedBeanDefinition

AnnotatedBeanDefinition

interface AnnotatedBeanDefinition : BeanDefinition

Extended org.springframework.beans.factory.config.BeanDefinition interface that exposes org.springframework.core.type.AnnotationMetadata about its bean class - without requiring the class to be loaded yet.

Author
Juergen Hoeller

Since
2.5

See Also
AnnotatedGenericBeanDefinitionorg.springframework.core.type.AnnotationMetadata

Functions

getFactoryMethodMetadata

abstract fun getFactoryMethodMetadata(): MethodMetadata

Obtain metadata for this bean definition's factory method, if any.

getMetadata

abstract fun getMetadata(): AnnotationMetadata

Obtain the annotation metadata (as well as basic class metadata) for this bean definition's bean class.

Inheritors

AnnotatedGenericBeanDefinition

open class AnnotatedGenericBeanDefinition : GenericBeanDefinition, AnnotatedBeanDefinition

Extension of the org.springframework.beans.factory.support.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).

ScannedGenericBeanDefinition

open class ScannedGenericBeanDefinition : GenericBeanDefinition, AnnotatedBeanDefinition

Extension of the org.springframework.beans.factory.support.GenericBeanDefinition class, based on an ASM ClassReader, with support for annotation metadata exposed through the AnnotatedBeanDefinition interface.

This class does not load the bean Class early. It rather retrieves all relevant metadata from the ".class" file itself, parsed with the ASM ClassReader. It is functionally equivalent to AnnotatedGenericBeanDefinition#AnnotatedGenericBeanDefinition(AnnotationMetadata) but distinguishes by type beans that have been scanned vs those that have been otherwise registered or detected by other means.