Class FullyQualifiedConfigurationBeanNameGenerator
java.lang.Object
org.springframework.context.annotation.AnnotationBeanNameGenerator
org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator
org.springframework.context.annotation.FullyQualifiedConfigurationBeanNameGenerator
- All Implemented Interfaces:
org.springframework.beans.factory.support.BeanNameGenerator
,ConfigurationBeanNameGenerator
public class FullyQualifiedConfigurationBeanNameGenerator
extends FullyQualifiedAnnotationBeanNameGenerator
implements ConfigurationBeanNameGenerator
Extended variant of
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. 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 long as the
application does not depend on @Bean
method names as bean names.
Where the name does matter, make sure to declare @Bean("myBeanName")
in such a scenario, even if it repeats the method name as the bean name.
- Since:
- 7.0
- Author:
- Juergen Hoeller
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FullyQualifiedConfigurationBeanNameGenerator
A convenient constant for a defaultFullyQualifiedConfigurationBeanNameGenerator
instance, as used for configuration-level import purposes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionderiveBeanName
(org.springframework.core.type.MethodMetadata beanMethod) Methods inherited from class org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator
buildDefaultBeanName
Methods inherited from class org.springframework.context.annotation.AnnotationBeanNameGenerator
buildDefaultBeanName, determineBeanNameFromAnnotation, generateBeanName, isStereotypeWithNameValue
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.beans.factory.support.BeanNameGenerator
generateBeanName
-
Field Details
-
INSTANCE
A convenient constant for a defaultFullyQualifiedConfigurationBeanNameGenerator
instance, as used for configuration-level import purposes.
-
-
Constructor Details
-
FullyQualifiedConfigurationBeanNameGenerator
public FullyQualifiedConfigurationBeanNameGenerator()
-
-
Method Details
-
deriveBeanName
Description copied from interface:ConfigurationBeanNameGenerator
Derive a default bean name for the given@Bean
method, in the absence of aname
attribute specified.- Specified by:
deriveBeanName
in interfaceConfigurationBeanNameGenerator
- Parameters:
beanMethod
- the method metadata for the@Bean
method- Returns:
- the default bean name to use
-