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

public Class FullyQualifiedAnnotationBeanNameGenerator

extends AnnotationBeanNameGenerator
Class Inheritance
Imports
org.springframework.beans.factory.config.BeanDefinition, org.springframework.util.Assert

An extension of AnnotationBeanNameGenerator that uses the fully qualified class name as the default bean name if an explicit bean name is not supplied via a supported type-level annotation such as @Component (see AnnotationBeanNameGenerator for details on supported annotations).

Favor this bean naming strategy over AnnotationBeanNameGenerator if you run into naming conflicts due to multiple autodetected components having the same non-qualified class name (i.e., classes with identical names but residing in different packages).

Note that an instance of this class is used by default for configuration-level import purposes; whereas, the default for component scanning purposes is a plain AnnotationBeanNameGenerator.

Authors
Juergen Hoeller, Sam Brannen
Since
5.2.3
See Also
org.springframework.beans.factory.support.DefaultBeanNameGenerator, AnnotationBeanNameGenerator, ConfigurationClassPostProcessor#IMPORT_BEAN_NAME_GENERATOR

Field Summary

Modifier and TypeField and Description
public static final FullyQualifiedAnnotationBeanNameGenerator
INSTANCE

Hides org.springframework.context.annotation.AnnotationBeanNameGenerator.INSTANCE.

A convenient constant for a default FullyQualifiedAnnotationBeanNameGenerator instance, as used for configuration-level import purposes.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected String
buildDefaultBeanName(BeanDefinition
the bean definition to build a bean name for
definition
)

Overrides org.springframework.context.annotation.AnnotationBeanNameGenerator.buildDefaultBeanName.

Derive a default bean name from the given bean definition.
Inherited from org.springframework.context.annotation.AnnotationBeanNameGenerator:
buildDefaultBeanNamedetermineBeanNameFromAnnotationgenerateBeanNameisStereotypeWithNameValue

Field Detail

INSTANCEback to summary
public static final FullyQualifiedAnnotationBeanNameGenerator INSTANCE

Hides org.springframework.context.annotation.AnnotationBeanNameGenerator.INSTANCE.

A convenient constant for a default FullyQualifiedAnnotationBeanNameGenerator instance, as used for configuration-level import purposes.

Since
5.2.11

Constructor Detail

FullyQualifiedAnnotationBeanNameGeneratorback to summary
public FullyQualifiedAnnotationBeanNameGenerator()

Method Detail

buildDefaultBeanNameback to summary
protected String buildDefaultBeanName(BeanDefinition definition)

Overrides org.springframework.context.annotation.AnnotationBeanNameGenerator.buildDefaultBeanName.

Doc from org.springframework.context.annotation.AnnotationBeanNameGenerator.buildDefaultBeanName.

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.

Parameters
definition:BeanDefinition

the bean definition to build a bean name for

Returns:String

the default bean name (never null)

Annotations
@Override