Top Description Fields Constructors Methods
org.springframework.context.annotation

public abstract Class AnnotationConfigUtils

extends Object
Class Inheritance
Imports
java.lang.annotation.Annotation, java.util.LinkedHashSet, .Set, java.util.function.Predicate, org.springframework.beans.factory.annotation.AnnotatedBeanDefinition, .AutowiredAnnotationBeanPostProcessor, org.springframework.beans.factory.config.BeanDefinition, .BeanDefinitionHolder, org.springframework.beans.factory.support.BeanDefinitionRegistry, .DefaultListableBeanFactory, .RootBeanDefinition, org.springframework.context.event.DefaultEventListenerFactory, .EventListenerMethodProcessor, org.springframework.context.support.GenericApplicationContext, org.springframework.core.annotation.AnnotationAttributes, .AnnotationAwareOrderComparator, .MergedAnnotation, org.springframework.core.type.AnnotatedTypeMetadata, .AnnotationMetadata, org.springframework.lang.Nullable, org.springframework.util.ClassUtils

Utility class that allows for convenient registration of common org.springframework.beans.factory.config.BeanPostProcessor and org.springframework.beans.factory.config.BeanFactoryPostProcessor definitions for annotation-based configuration. Also registers a common org.springframework.beans.factory.support.AutowireCandidateResolver.
Authors
Mark Fisher, Juergen Hoeller, Chris Beams, Phillip Webb, Stephane Nicoll, Sam Brannen
Since
2.5
See Also
ContextAnnotationAutowireCandidateResolver, ConfigurationClassPostProcessor, CommonAnnotationBeanPostProcessor, org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor, org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor

Field Summary

Modifier and TypeField and Description
public static final String
AUTOWIRED_ANNOTATION_PROCESSOR_BEAN_NAME

The bean name of the internally managed Autowired annotation processor.

private static final ClassLoader
public static final String
COMMON_ANNOTATION_PROCESSOR_BEAN_NAME

The bean name of the internally managed common annotation processor.

public static final String
CONFIGURATION_ANNOTATION_PROCESSOR_BEAN_NAME

The bean name of the internally managed Configuration annotation processor.

public static final String
CONFIGURATION_BEAN_NAME_GENERATOR

The bean name of the internally managed BeanNameGenerator for use when processing Configuration classes.

public static final String
EVENT_LISTENER_FACTORY_BEAN_NAME

The bean name of the internally managed EventListenerFactory.

public static final String
EVENT_LISTENER_PROCESSOR_BEAN_NAME

The bean name of the internally managed @EventListener annotation processor.

private static final boolean
private static final boolean
private static final boolean
public static final String
PERSISTENCE_ANNOTATION_PROCESSOR_BEAN_NAME

The bean name of the internally managed JPA annotation processor.

private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv static BeanDefinitionHolder
pack-priv static AnnotationAttributes
attributesFor(AnnotatedTypeMetadata metadata, Class<?> annotationType)

pack-priv static AnnotationAttributes
attributesFor(AnnotatedTypeMetadata metadata, String annotationTypeName)

pack-priv static Set<AnnotationAttributes>
attributesForRepeatable(AnnotationMetadata metadata, Class<? extends Annotation> annotationType, Class<? extends Annotation> containerType, Predicate<MergedAnnotation<? extends Annotation>> predicate)

pack-priv static Set<AnnotationAttributes>
attributesForRepeatable(AnnotationMetadata metadata, Class<? extends Annotation> annotationType, Class<? extends Annotation> containerType, boolean sortByReversedMetaDistance)

public static void
pack-priv static void
public static void
registerAnnotationConfigProcessors(BeanDefinitionRegistry
the registry to operate on
registry
)

Register all relevant annotation post processors in the given registry.

public static Set<BeanDefinitionHolder>

Returns:

a Set of BeanDefinitionHolders, containing all bean definitions that have actually been registered by this call
registerAnnotationConfigProcessors
(BeanDefinitionRegistry
the registry to operate on
registry
,
Object
the configuration source element (already extracted) that this registration was triggered from. May be null.
source
)

Register all relevant annotation post processors in the given registry.

private static BeanDefinitionHolder
private static DefaultListableBeanFactory
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

AUTOWIRED_ANNOTATION_PROCESSOR_BEAN_NAMEback to summary
public static final String AUTOWIRED_ANNOTATION_PROCESSOR_BEAN_NAME

The bean name of the internally managed Autowired annotation processor.

classLoaderback to summary
private static final ClassLoader classLoader
COMMON_ANNOTATION_PROCESSOR_BEAN_NAMEback to summary
public static final String COMMON_ANNOTATION_PROCESSOR_BEAN_NAME

The bean name of the internally managed common annotation processor.

CONFIGURATION_ANNOTATION_PROCESSOR_BEAN_NAMEback to summary
public static final String CONFIGURATION_ANNOTATION_PROCESSOR_BEAN_NAME

The bean name of the internally managed Configuration annotation processor.

CONFIGURATION_BEAN_NAME_GENERATORback to summary
public static final String CONFIGURATION_BEAN_NAME_GENERATOR

The bean name of the internally managed BeanNameGenerator for use when processing Configuration classes. Set by AnnotationConfigApplicationContext and AnnotationConfigWebApplicationContext during bootstrap in order to make any custom name generation strategy available to the underlying ConfigurationClassPostProcessor.

Since
3.1.1
EVENT_LISTENER_FACTORY_BEAN_NAMEback to summary
public static final String EVENT_LISTENER_FACTORY_BEAN_NAME

The bean name of the internally managed EventListenerFactory.

EVENT_LISTENER_PROCESSOR_BEAN_NAMEback to summary
public static final String EVENT_LISTENER_PROCESSOR_BEAN_NAME

The bean name of the internally managed @EventListener annotation processor.

jakartaAnnotationsPresentback to summary
private static final boolean jakartaAnnotationsPresent
jpaPresentback to summary
private static final boolean jpaPresent
jsr250Presentback to summary
private static final boolean jsr250Present
PERSISTENCE_ANNOTATION_PROCESSOR_BEAN_NAMEback to summary
public static final String PERSISTENCE_ANNOTATION_PROCESSOR_BEAN_NAME

The bean name of the internally managed JPA annotation processor.

PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAMEback to summary
private static final String PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAME

Constructor Detail

AnnotationConfigUtilsback to summary
public AnnotationConfigUtils()

Method Detail

applyScopedProxyModeback to summary
pack-priv static BeanDefinitionHolder applyScopedProxyMode(ScopeMetadata metadata, BeanDefinitionHolder definition, BeanDefinitionRegistry registry)
attributesForback to summary
pack-priv static AnnotationAttributes attributesFor(AnnotatedTypeMetadata metadata, Class<?> annotationType)
Annotations
@Nullable
attributesForback to summary
pack-priv static AnnotationAttributes attributesFor(AnnotatedTypeMetadata metadata, String annotationTypeName)
Annotations
@Nullable
attributesForRepeatableback to summary
pack-priv static Set<AnnotationAttributes> attributesForRepeatable(AnnotationMetadata metadata, Class<? extends Annotation> annotationType, Class<? extends Annotation> containerType, Predicate<MergedAnnotation<? extends Annotation>> predicate)
attributesForRepeatableback to summary
pack-priv static Set<AnnotationAttributes> attributesForRepeatable(AnnotationMetadata metadata, Class<? extends Annotation> annotationType, Class<? extends Annotation> containerType, boolean sortByReversedMetaDistance)
processCommonDefinitionAnnotationsback to summary
public static void processCommonDefinitionAnnotations(AnnotatedBeanDefinition abd)
processCommonDefinitionAnnotationsback to summary
pack-priv static void processCommonDefinitionAnnotations(AnnotatedBeanDefinition abd, AnnotatedTypeMetadata metadata)
registerAnnotationConfigProcessorsback to summary
public static void registerAnnotationConfigProcessors(BeanDefinitionRegistry registry)

Register all relevant annotation post processors in the given registry.

Parameters
registry:BeanDefinitionRegistry

the registry to operate on

registerAnnotationConfigProcessorsback to summary
public static Set<BeanDefinitionHolder> registerAnnotationConfigProcessors(BeanDefinitionRegistry registry, Object source)

Register all relevant annotation post processors in the given registry.

Parameters
registry:BeanDefinitionRegistry

the registry to operate on

source:Object

the configuration source element (already extracted) that this registration was triggered from. May be null.

Returns:Set<BeanDefinitionHolder>

a Set of BeanDefinitionHolders, containing all bean definitions that have actually been registered by this call

registerPostProcessorback to summary
private static BeanDefinitionHolder registerPostProcessor(BeanDefinitionRegistry registry, RootBeanDefinition definition, String beanName)
unwrapDefaultListableBeanFactoryback to summary
private static DefaultListableBeanFactory unwrapDefaultListableBeanFactory(BeanDefinitionRegistry registry)
Annotations
@Nullable