public class FullyQualifiedAnnotationBeanNameGenerator extends AnnotationBeanNameGenerator
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
.
DefaultBeanNameGenerator
,
AnnotationBeanNameGenerator
,
ConfigurationClassPostProcessor.IMPORT_BEAN_NAME_GENERATOR
Modifier and Type | Field and Description |
---|---|
static FullyQualifiedAnnotationBeanNameGenerator |
INSTANCE
A convenient constant for a default
FullyQualifiedAnnotationBeanNameGenerator
instance, as used for configuration-level import purposes. |
Constructor and Description |
---|
FullyQualifiedAnnotationBeanNameGenerator() |
Modifier and Type | Method and Description |
---|---|
protected String |
buildDefaultBeanName(BeanDefinition definition)
Derive a default bean name from the given bean definition.
|
buildDefaultBeanName, determineBeanNameFromAnnotation, generateBeanName, isStereotypeWithNameValue
public static final FullyQualifiedAnnotationBeanNameGenerator INSTANCE
FullyQualifiedAnnotationBeanNameGenerator
instance, as used for configuration-level import purposes.public FullyQualifiedAnnotationBeanNameGenerator()
protected String buildDefaultBeanName(BeanDefinition definition)
AnnotationBeanNameGenerator
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.
buildDefaultBeanName
in class AnnotationBeanNameGenerator
definition
- the bean definition to build a bean name fornull
)