This is an alternative to ClassPathBeanDefinitionScanner, applying
the same resolution of annotations but for explicitly registered classes only.
AnnotationConfigApplicationContext#register
| Modifier and Type | Field and Description |
|---|---|
| private BeanNameGenerator | |
| private ConditionEvaluator | |
| private final BeanDefinitionRegistry | |
| private ScopeMetadataResolver |
| Access | Constructor and Description |
|---|---|
| public | AnnotatedBeanDefinitionReader(BeanDefinitionRegistry
the registry)BeanFactory to load bean definitions into,
in the form of a BeanDefinitionRegistryCreate a new |
| public | AnnotatedBeanDefinitionReader(BeanDefinitionRegistry
the registry, Environment BeanFactory to load bean definitions into,
in the form of a BeanDefinitionRegistrythe environment)Environment to use when evaluating bean definition
profiles.Create a new |
| Modifier and Type | Method and Description |
|---|---|
| private <T> void | doRegisterBean(Class<T>
the class of the bean beanClass, String an explicit name for the bean name, Class<? extends Annotation>[] specific qualifier annotations to consider, if any,
in addition to qualifiers at the bean class level qualifiers, Supplier<T> a callback for creating an instance of the bean
(may be supplier, BeanDefinitionCustomizer[] null)one or more callbacks for customizing the factory's
customizers)BeanDefinition, e.g. setting a lazy-init or primary flagRegister a bean from the given bean class, deriving its metadata from class-declared annotations. |
| private static Environment | getOrCreateEnvironment(BeanDefinitionRegistry registry)
Get the Environment from the given registry if possible, otherwise return a new StandardEnvironment. |
| public final BeanDefinitionRegistry | |
| public void | register(Class<?>...
one or more component classes,
e.g. componentClasses)@Configuration classesRegister one or more component classes to be processed. |
| public void | registerBean(Class<?>
the class of the bean beanClass)Register a bean from the given bean class, deriving its metadata from class-declared annotations. |
| public void | registerBean(Class<?>
the class of the bean beanClass, String an explicit name for the bean
(or name)null for generating a default bean name)Register a bean from the given bean class, deriving its metadata from class-declared annotations. |
| public void | registerBean(Class<?>
the class of the bean beanClass, Class<? extends Annotation>... specific qualifier annotations to consider,
in addition to qualifiers at the bean class level qualifiers)Register a bean from the given bean class, deriving its metadata from class-declared annotations. |
| public void | registerBean(Class<?>
the class of the bean beanClass, String an explicit name for the bean
(or name, Class<? extends Annotation>... null for generating a default bean name)specific qualifier annotations to consider,
in addition to qualifiers at the bean class level qualifiers)Register a bean from the given bean class, deriving its metadata from class-declared annotations. |
| public <T> void | registerBean(Class<T>
the class of the bean beanClass, Supplier<T> a callback for creating an instance of the bean
(may be supplier)null)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). |
| public <T> void | registerBean(Class<T>
the class of the bean beanClass, String an explicit name for the bean
(or name, Supplier<T> null for generating a default bean name)a callback for creating an instance of the bean
(may be supplier)null)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). |
| public <T> void | registerBean(Class<T>
the class of the bean beanClass, String an explicit name for the bean
(or name, Supplier<T> null for generating a default bean name)a callback for creating an instance of the bean
(may be supplier, BeanDefinitionCustomizer... null)one or more callbacks for customizing the factory's
customizers)BeanDefinition, e.g. setting a lazy-init or primary flagRegister a bean from the given bean class, deriving its metadata from class-declared annotations. |
| public void | setBeanNameGenerator(BeanNameGenerator beanNameGenerator)
Set the |
| public void | setEnvironment(Environment environment)
Set the |
| public void | setScopeMetadataResolver(ScopeMetadataResolver scopeMetadataResolver)
Set the |
| beanNameGenerator | back to summary |
|---|---|
| private BeanNameGenerator beanNameGenerator | |
| conditionEvaluator | back to summary |
|---|---|
| private ConditionEvaluator conditionEvaluator | |
| registry | back to summary |
|---|---|
| private final BeanDefinitionRegistry registry | |
| scopeMetadataResolver | back to summary |
|---|---|
| private ScopeMetadataResolver scopeMetadataResolver | |
| AnnotatedBeanDefinitionReader | back to summary |
|---|---|
| public AnnotatedBeanDefinitionReader(BeanDefinitionRegistry registry) Create a new If the registry is
| |
| AnnotatedBeanDefinitionReader | back to summary |
|---|---|
| public AnnotatedBeanDefinitionReader(BeanDefinitionRegistry registry, Environment environment) Create a new
| |
| doRegisterBean | back to summary |
|---|---|
| private <T> void doRegisterBean(Class<T> beanClass, String name, Class<? extends Annotation>[] qualifiers, Supplier<T> supplier, BeanDefinitionCustomizer[] customizers) Register a bean from the given bean class, deriving its metadata from class-declared annotations.
| |
| getOrCreateEnvironment | back to summary |
|---|---|
| private static Environment getOrCreateEnvironment(BeanDefinitionRegistry registry) Get the Environment from the given registry if possible, otherwise return a new StandardEnvironment. | |
| getRegistry | back to summary |
|---|---|
| public final BeanDefinitionRegistry getRegistry() Get the BeanDefinitionRegistry that this reader operates on. | |
| register | back to summary |
|---|---|
| public void register(Class<?>... componentClasses) Register one or more component classes to be processed. Calls to
| |
| registerBean | back to summary |
|---|---|
| public void registerBean(Class<?> beanClass) Register a bean from the given bean class, deriving its metadata from class-declared annotations.
| |
| registerBean | back to summary |
|---|---|
| public void registerBean(Class<?> beanClass, String name) Register a bean from the given bean class, deriving its metadata from class-declared annotations. | |
| registerBean | back to summary |
|---|---|
| public void registerBean(Class<?> beanClass, Class<? extends Annotation>... qualifiers) Register a bean from the given bean class, deriving its metadata from class-declared annotations.
| |
| registerBean | back to summary |
|---|---|
| public 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.
| |
| registerBean | back to summary |
|---|---|
| public <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). | |
| registerBean | back to summary |
|---|---|
| public <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). | |
| registerBean | back to summary |
|---|---|
| public <T> void registerBean(Class<T> beanClass, String name, Supplier<T> supplier, BeanDefinitionCustomizer... customizers) Register a bean from the given bean class, deriving its metadata from class-declared annotations.
| |
| setBeanNameGenerator | back to summary |
|---|---|
| public void setBeanNameGenerator(BeanNameGenerator beanNameGenerator) Set the The default is a | |
| setEnvironment | back to summary |
|---|---|
| public void setEnvironment(Environment environment) Set the The default is a | |
| setScopeMetadataResolver | back to summary |
|---|---|
| public void setScopeMetadataResolver(ScopeMetadataResolver scopeMetadataResolver) Set the The default is an | |