org.springframework.context.annotation

## 类 AnnotationBeanNameGenerator

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

- 所有已实现的接口:
    org.springframework.beans.factory.support.BeanNameGenerator

      public class AnnotationBeanNameGenerator
      extends Object
      implements org.springframework.beans.factory.support.BeanNameGenerator

  `BeanNameGenerator` implementation for bean classes annotated with the `@Component` annotation or with another annotation that is itself annotated with `@Component` as a meta-annotation. For example, Spring's stereotype annotations (such as `@Repository`) are themselves annotated with `@Component`.

  Also supports Java EE 6's `ManagedBean` and JSR-330's `Named` annotations, if available. Note that Spring component annotations always override such standard annotations.

  If the annotation's value doesn't indicate a bean name, an appropriate name will be built based on the short name of the class (with the first letter lower-cased). For example:

      com.xyz.FooServiceImpl -> fooServiceImpl

  从以下版本开始:
    2.5
  作者:
    Juergen Hoeller, Mark Fisher
  另请参阅:
    `Component.value()`, `Repository.value()`, `Service.value()`, `Controller.value()`, `Named`

- - ### 构造器概要

    构造器
    构造器和说明
    `AnnotationBeanNameGenerator()`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected String` | `buildDefaultBeanName(org.springframework.beans.factory.config.BeanDefinition definition)` Derive a default bean name from the given bean definition.
    `protected String` | `buildDefaultBeanName(org.springframework.beans.factory.config.BeanDefinition definition, org.springframework.beans.factory.support.BeanDefinitionRegistry registry)` Derive a default bean name from the given bean definition.
    `protected String` | `determineBeanNameFromAnnotation(org.springframework.beans.factory.annotation.AnnotatedBeanDefinition annotatedDef)` Derive a bean name from one of the annotations on the class.
    `String` | `generateBeanName(org.springframework.beans.factory.config.BeanDefinition definition, org.springframework.beans.factory.support.BeanDefinitionRegistry registry)`
    `protected boolean` | `isStereotypeWithNameValue(String annotationType, Set<String> metaAnnotationTypes, Map<String,Object> attributes)` Check whether the given annotation is a stereotype that is allowed to suggest a component name through its annotation `value()`.

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

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

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

    - #### AnnotationBeanNameGenerator

          public AnnotationBeanNameGenerator()

  - ### 方法详细资料

    - #### generateBeanName

          public String generateBeanName(org.springframework.beans.factory.config.BeanDefinition definition,
                                         org.springframework.beans.factory.support.BeanDefinitionRegistry registry)

      指定者:
        `generateBeanName` 在接口中 `org.springframework.beans.factory.support.BeanNameGenerator`

    - #### determineBeanNameFromAnnotation

          @Nullable
          protected String determineBeanNameFromAnnotation(org.springframework.beans.factory.annotation.AnnotatedBeanDefinition annotatedDef)

      Derive a bean name from one of the annotations on the class.
      参数:
        `annotatedDef` - the annotation-aware bean definition
      返回:
        the bean name, or `null` if none is found

    - #### isStereotypeWithNameValue

          protected boolean isStereotypeWithNameValue(String annotationType,
                                                      Set<String> metaAnnotationTypes,
                                                      @Nullable
                                                      Map<String,Object> attributes)

      Check whether the given annotation is a stereotype that is allowed to suggest a component name through its annotation `value()`.
      参数:
        `annotationType` - the name of the annotation class to check
        `metaAnnotationTypes` - the names of meta-annotations on the given annotation
        `attributes` - the map of attributes for the given annotation
      返回:
        whether the annotation qualifies as a stereotype with component name

    - #### buildDefaultBeanName

          protected String buildDefaultBeanName(org.springframework.beans.factory.config.BeanDefinition definition,
                                                org.springframework.beans.factory.support.BeanDefinitionRegistry registry)

      Derive a default bean name from the given bean definition.

      The default implementation delegates to `buildDefaultBeanName(BeanDefinition)`.

      参数:
        `definition` - the bean definition to build a bean name for
        `registry` - the registry that the given bean definition is being registered with
      返回:
        the default bean name (never `null`)

    - #### buildDefaultBeanName

          protected String buildDefaultBeanName(org.springframework.beans.factory.config.BeanDefinition definition)

      Derive a default bean name from the given bean definition.

      The default implementation simply builds a decapitalized version of the short class name: e.g. "mypackage.MyJdbcDao" -> "myJdbcDao".

      Note that inner classes will thus have names of the form "outerClassName.InnerClassName", which because of the period in the name may be an issue if you are autowiring by name.

      参数:
        `definition` - the bean definition to build a bean name for
      返回:
        the default bean name (never `null`)