org.springframework.context.annotation

## 类 AnnotatedBeanDefinitionReader

- java.lang.Object
- - org.springframework.context.annotation.AnnotatedBeanDefinitionReader

-     public class AnnotatedBeanDefinitionReader
      extends Object

  Convenient adapter for programmatic registration of annotated bean classes. This is an alternative to `ClassPathBeanDefinitionScanner`, applying the same resolution of annotations but for explicitly registered classes only.
  从以下版本开始:
    3.0
  作者:
    Juergen Hoeller, Chris Beams, Sam Brannen, Phillip Webb
  另请参阅:
    `AnnotationConfigApplicationContext.register(java.lang.Class<?>...)`

- - ### 构造器概要

    构造器
    构造器和说明
    `AnnotatedBeanDefinitionReader(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)` Create a new `AnnotatedBeanDefinitionReader` for the given registry.
    `AnnotatedBeanDefinitionReader(org.springframework.beans.factory.support.BeanDefinitionRegistry registry, org.springframework.core.env.Environment environment)` Create a new `AnnotatedBeanDefinitionReader` for the given registry and using the given `Environment`.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `org.springframework.beans.factory.support.BeanDefinitionRegistry` | `getRegistry()` Return the BeanDefinitionRegistry that this scanner operates on.
    `void` | `register(Class<?>... annotatedClasses)` Register one or more annotated classes to be processed.
    `void` | `registerBean(Class<?> annotatedClass)` Register a bean from the given bean class, deriving its metadata from class-declared annotations.
    `void` | `registerBean(Class<?> annotatedClass, Class<? extends Annotation>... qualifiers)` Register a bean from the given bean class, deriving its metadata from class-declared annotations.
    `void` | `registerBean(Class<?> annotatedClass, 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> annotatedClass, String name, Supplier<T> instanceSupplier)` 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> annotatedClass, Supplier<T> instanceSupplier)` 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 BeanNameGenerator to use for detected bean classes.
    `void` | `setEnvironment(org.springframework.core.env.Environment environment)` Set the Environment to use when evaluating whether `@Conditional`-annotated component classes should be registered.
    `void` | `setScopeMetadataResolver(ScopeMetadataResolver scopeMetadataResolver)` Set the ScopeMetadataResolver to use for detected bean classes.

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### AnnotatedBeanDefinitionReader

          public AnnotatedBeanDefinitionReader(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)

      Create a new `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` - AnnotationConfigApplicationContext实现了BeanDefinitionRegistry的接口 in the form of a `BeanDefinitionRegistry`
      另请参阅:
        `AnnotatedBeanDefinitionReader(BeanDefinitionRegistry, Environment)`, `setEnvironment(Environment)`

    - #### AnnotatedBeanDefinitionReader

          public AnnotatedBeanDefinitionReader(org.springframework.beans.factory.support.BeanDefinitionRegistry registry,
                                               org.springframework.core.env.Environment environment)

      Create a new `AnnotatedBeanDefinitionReader` for the given registry and using the given `Environment`.
      参数:
        `registry` - the `BeanFactory` to load bean definitions into, in the form of a `BeanDefinitionRegistry`
        `environment` - the `Environment` to use when evaluating bean definition profiles.
      从以下版本开始:
        3.1

  - ### 方法详细资料

    - #### getRegistry

          public final org.springframework.beans.factory.support.BeanDefinitionRegistry getRegistry()

      Return the BeanDefinitionRegistry that this scanner operates on.

    - #### setEnvironment

          public void setEnvironment(org.springframework.core.env.Environment environment)

      Set the Environment to use when evaluating whether `@Conditional`-annotated component classes should be registered.

      The default is a `StandardEnvironment`.

      另请参阅:
        `registerBean(Class, String, Class...)`

    - #### setBeanNameGenerator

          public void setBeanNameGenerator(@Nullable
                                           org.springframework.beans.factory.support.BeanNameGenerator beanNameGenerator)

      Set the BeanNameGenerator to use for detected bean classes.

      The default is a `AnnotationBeanNameGenerator`.

    - #### setScopeMetadataResolver

          public void setScopeMetadataResolver(@Nullable
                                               ScopeMetadataResolver scopeMetadataResolver)

      Set the ScopeMetadataResolver to use for detected bean classes.

      The default is an `AnnotationScopeMetadataResolver`.

    - #### register

          public void register(Class<?>... annotatedClasses)

      Register one or more annotated classes to be processed.

      Calls to `register` are idempotent; adding the same annotated class more than once has no additional effect.

      参数:
        `annotatedClasses` - one or more annotated classes, e.g. `@Configuration` classes

    - #### registerBean

          public void registerBean(Class<?> annotatedClass)

      Register a bean from the given bean class, deriving its metadata from class-declared annotations.
      参数:
        `annotatedClass` - the class of the bean

    - #### registerBean

          public <T> void registerBean(Class<T> annotatedClass,
                                       @Nullable
                                       Supplier<T> instanceSupplier)

      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).
      参数:
        `annotatedClass` - the class of the bean
        `instanceSupplier` - a callback for creating an instance of the bean (may be `null`)
      从以下版本开始:
        5.0

    - #### registerBean

          public <T> void registerBean(Class<T> annotatedClass,
                                       String name,
                                       @Nullable
                                       Supplier<T> instanceSupplier)

      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).
      参数:
        `annotatedClass` - the class of the bean
        `name` - an explicit name for the bean
        `instanceSupplier` - a callback for creating an instance of the bean (may be `null`)
      从以下版本开始:
        5.0

    - #### registerBean

          public void registerBean(Class<?> annotatedClass,
                                   Class<? extends Annotation>... qualifiers)

      Register a bean from the given bean class, deriving its metadata from class-declared annotations.
      参数:
        `annotatedClass` - the class of the bean
        `qualifiers` - specific qualifier annotations to consider, in addition to qualifiers at the bean class level

    - #### registerBean

          public void registerBean(Class<?> annotatedClass,
                                   String name,
                                   Class<? extends Annotation>... qualifiers)

      Register a bean from the given bean class, deriving its metadata from class-declared annotations.
      参数:
        `annotatedClass` - the class of the bean
        `name` - an explicit name for the bean
        `qualifiers` - specific qualifier annotations to consider, in addition to qualifiers at the bean class level