public class AnnotatedBeanDefinitionReader extends Object
This is an alternative to ClassPathBeanDefinitionScanner, applying
 the same resolution of annotations but for explicitly registered classes only.
AnnotationConfigApplicationContext.register(java.lang.Class<?>...)| Constructor and Description | 
|---|
| AnnotatedBeanDefinitionReader(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)Create a new  AnnotatedBeanDefinitionReaderfor the given registry. | 
| AnnotatedBeanDefinitionReader(org.springframework.beans.factory.support.BeanDefinitionRegistry registry,
                             org.springframework.core.env.Environment environment)Create a new  AnnotatedBeanDefinitionReaderfor the given registry,
 using the givenEnvironment. | 
| Modifier and Type | Method and Description | 
|---|---|
| org.springframework.beans.factory.support.BeanDefinitionRegistry | getRegistry()Get the BeanDefinitionRegistry that this reader operates on. | 
| void | register(Class<?>... componentClasses)Register one or more component classes to be processed. | 
| void | registerBean(Class<?> beanClass)Register a bean from the given bean class, deriving its metadata from
 class-declared annotations. | 
| void | registerBean(Class<?> beanClass,
            Class<? extends Annotation>... qualifiers)Register a bean from the given bean class, deriving its metadata from
 class-declared annotations. | 
| void | registerBean(Class<?> beanClass,
            String name)Register a bean from the given bean class, deriving its metadata from
 class-declared annotations. | 
| void | registerBean(Class<?> beanClass,
            String name,
            Class<? extends Annotation>... qualifiers)Register a bean from the given bean class, deriving its metadata from
 class-declared annotations. | 
| <T> void | registerBean(Class<T> beanClass,
            String name,
            Supplier<T> supplier)Register a bean from the given bean class, deriving its metadata from
 class-declared annotations, using the given supplier for obtaining a new
 instance (possibly declared as a lambda expression or method reference). | 
| <T> void | registerBean(Class<T> beanClass,
            String name,
            Supplier<T> supplier,
            org.springframework.beans.factory.config.BeanDefinitionCustomizer... customizers)Register a bean from the given bean class, deriving its metadata from
 class-declared annotations. | 
| <T> void | registerBean(Class<T> beanClass,
            Supplier<T> supplier)Register a bean from the given bean class, deriving its metadata from
 class-declared annotations, using the given supplier for obtaining a new
 instance (possibly declared as a lambda expression or method reference). | 
| void | setBeanNameGenerator(org.springframework.beans.factory.support.BeanNameGenerator beanNameGenerator)Set the  BeanNameGeneratorto use for detected bean classes. | 
| void | setEnvironment(org.springframework.core.env.Environment environment)Set the  Environmentto use when evaluating whether@Conditional-annotated component classes should be registered. | 
| void | setScopeMetadataResolver(ScopeMetadataResolver scopeMetadataResolver)Set the  ScopeMetadataResolverto use for registered component classes. | 
public AnnotatedBeanDefinitionReader(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)
AnnotatedBeanDefinitionReader for the given registry.
 If the registry is EnvironmentCapable, e.g. is an ApplicationContext,
 the Environment will be inherited, otherwise a new
 StandardEnvironment will be created and used.
registry - the BeanFactory to load bean definitions into,
 in the form of a BeanDefinitionRegistryAnnotatedBeanDefinitionReader(BeanDefinitionRegistry, Environment), 
setEnvironment(Environment)public AnnotatedBeanDefinitionReader(org.springframework.beans.factory.support.BeanDefinitionRegistry registry,
                                     org.springframework.core.env.Environment environment)
AnnotatedBeanDefinitionReader for the given registry,
 using the given Environment.registry - the BeanFactory to load bean definitions into,
 in the form of a BeanDefinitionRegistryenvironment - the Environment to use when evaluating bean definition
 profiles.public final org.springframework.beans.factory.support.BeanDefinitionRegistry getRegistry()
public void setEnvironment(org.springframework.core.env.Environment environment)
Environment to use when evaluating whether
 @Conditional-annotated component classes should be registered.
 The default is a StandardEnvironment.
registerBean(Class, String, Class...)public void setBeanNameGenerator(@Nullable
                                 org.springframework.beans.factory.support.BeanNameGenerator beanNameGenerator)
BeanNameGenerator to use for detected bean classes.
 The default is a AnnotationBeanNameGenerator.
public void setScopeMetadataResolver(@Nullable
                                     ScopeMetadataResolver scopeMetadataResolver)
ScopeMetadataResolver to use for registered component classes.
 The default is an AnnotationScopeMetadataResolver.
public void register(Class<?>... componentClasses)
Calls to register are idempotent; adding the same
 component class more than once has no additional effect.
componentClasses - one or more component classes,
 e.g. @Configuration classespublic void registerBean(Class<?> beanClass)
beanClass - the class of the beanpublic void registerBean(Class<?> beanClass, @Nullable String name)
beanClass - the class of the beanname - an explicit name for the bean
 (or null for generating a default bean name)public void registerBean(Class<?> beanClass, Class<? extends Annotation>... qualifiers)
beanClass - the class of the beanqualifiers - specific qualifier annotations to consider,
 in addition to qualifiers at the bean class levelpublic void registerBean(Class<?> beanClass, @Nullable String name, Class<? extends Annotation>... qualifiers)
beanClass - the class of the beanname - an explicit name for the bean
 (or null for generating a default bean name)qualifiers - specific qualifier annotations to consider,
 in addition to qualifiers at the bean class levelpublic <T> void registerBean(Class<T> beanClass, @Nullable Supplier<T> supplier)
beanClass - the class of the beansupplier - a callback for creating an instance of the bean
 (may be null)public <T> void registerBean(Class<T> beanClass, @Nullable String name, @Nullable Supplier<T> supplier)
beanClass - the class of the beanname - an explicit name for the bean
 (or null for generating a default bean name)supplier - a callback for creating an instance of the bean
 (may be null)public <T> void registerBean(Class<T> beanClass, @Nullable String name, @Nullable Supplier<T> supplier, org.springframework.beans.factory.config.BeanDefinitionCustomizer... customizers)
beanClass - the class of the beanname - an explicit name for the bean
 (or null for generating a default bean name)supplier - a callback for creating an instance of the bean
 (may be null)customizers - one or more callbacks for customizing the factory's
 BeanDefinition, e.g. setting a lazy-init or primary flag