spring-framework / org.springframework.context.annotation / ConfigurationClassPostProcessor / setBeanNameGenerator

setBeanNameGenerator

open fun setBeanNameGenerator(beanNameGenerator: BeanNameGenerator): Unit

Set the BeanNameGenerator to be used when triggering component scanning from Configuration classes and when registering Import'ed configuration classes. The default is a standard AnnotationBeanNameGenerator for scanned components (compatible with the default in ClassPathBeanDefinitionScanner) and a variant thereof for imported configuration classes (using unique fully-qualified class names instead of standard component overriding).

Note that this strategy does not apply to Bean methods.

This setter is typically only appropriate when configuring the post-processor as a standalone bean definition in XML, e.g. not using the dedicated AnnotationConfig* application contexts or the <context:annotation-config> element. Any bean name generator specified against the application context will take precedence over any value set here.

Since
3.1.1

See Also
AnnotationConfigApplicationContext#setBeanNameGenerator(BeanNameGenerator)AnnotationConfigUtils#CONFIGURATION_BEAN_NAME_GENERATOR