Class FullyQualifiedConfigurationBeanNameGenerator
- All Implemented Interfaces:
BeanNameGenerator, ConfigurationBeanNameGenerator
FullyQualifiedAnnotationBeanNameGenerator for
@Configuration class purposes, not only enforcing
fully-qualified names for component and configuration classes themselves
but also fully-qualified default bean names ("className.methodName") for
@Bean methods. By default, this only affects methods without
an explicit name attribute specified.
This provides an alternative to the default bean name generation for
@Bean methods (which uses the plain method name), primarily for use
in large applications with potential bean name overlaps. Favor this bean
naming strategy over FullyQualifiedAnnotationBeanNameGenerator if
you expect such naming conflicts for @Bean methods.
As of 7.1, the original @Bean method name will be registered
as an alias if that name has not been taken already: effectively on first
occurrence, whereas any later @Bean methods of the same name will
not have aliases applied. This preserves the availability of common beans
under the original bean names for retrieval and injection purposes.
- Since:
- 7.0
- Author:
- Juergen Hoeller
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FullyQualifiedConfigurationBeanNameGeneratorA convenient constant for a defaultFullyQualifiedConfigurationBeanNameGeneratorinstance, as used for configuration-level import purposes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionderiveBeanName(MethodMetadata beanMethod, @Nullable String beanName) Methods inherited from class FullyQualifiedAnnotationBeanNameGenerator
buildDefaultBeanNameMethods inherited from class AnnotationBeanNameGenerator
buildDefaultBeanName, determineBeanNameFromAnnotation, generateBeanName, isStereotypeWithNameValueMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BeanNameGenerator
generateBeanName
-
Field Details
-
INSTANCE
A convenient constant for a defaultFullyQualifiedConfigurationBeanNameGeneratorinstance, as used for configuration-level import purposes.
-
-
Constructor Details
-
FullyQualifiedConfigurationBeanNameGenerator
public FullyQualifiedConfigurationBeanNameGenerator()
-
-
Method Details
-
deriveBeanName
Description copied from interface:ConfigurationBeanNameGeneratorDerive a default bean name for the given@Beanmethod, taking into account the specifiednameattribute.As of 7.1, the original
@Beanname (typically the method name) will be registered as an alias if that name has not been taken already.- Specified by:
deriveBeanNamein interfaceConfigurationBeanNameGenerator- Parameters:
beanMethod- the method metadata for the@BeanmethodbeanName- thenameattribute ornullif none is specified- Returns:
- the default bean name to use
-