use of org.springframework.beans.factory.support.DefaultBeanNameGenerator in project spring-boot by spring-projects.
the class SpringApplicationTests method customBeanNameGenerator.
@Test
void customBeanNameGenerator() {
TestSpringApplication application = new TestSpringApplication(ExampleWebConfig.class);
BeanNameGenerator beanNameGenerator = new DefaultBeanNameGenerator();
application.setBeanNameGenerator(beanNameGenerator);
this.context = application.run();
then(application.getLoader()).should().setBeanNameGenerator(beanNameGenerator);
Object actualGenerator = this.context.getBean(AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR);
assertThat(actualGenerator).isSameAs(beanNameGenerator);
}
use of org.springframework.beans.factory.support.DefaultBeanNameGenerator in project spring-boot by spring-projects.
the class SpringApplicationTests method customBeanNameGeneratorWithNonWebApplication.
@Test
void customBeanNameGeneratorWithNonWebApplication() {
TestSpringApplication application = new TestSpringApplication(ExampleWebConfig.class);
application.setWebApplicationType(WebApplicationType.NONE);
BeanNameGenerator beanNameGenerator = new DefaultBeanNameGenerator();
application.setBeanNameGenerator(beanNameGenerator);
this.context = application.run();
then(application.getLoader()).should().setBeanNameGenerator(beanNameGenerator);
Object actualGenerator = this.context.getBean(AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR);
assertThat(actualGenerator).isSameAs(beanNameGenerator);
}
Aggregations