|
|
|
@ -53,6 +53,7 @@ import org.springframework.context.ConfigurableApplicationContext;
|
|
|
|
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
|
|
|
|
import org.springframework.context.annotation.AnnotationConfigUtils;
|
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
import org.springframework.context.event.ContextRefreshedEvent;
|
|
|
|
|
import org.springframework.context.event.SimpleApplicationEventMulticaster;
|
|
|
|
@ -403,6 +404,21 @@ public class SpringApplicationTests {
|
|
|
|
|
sameInstance((Object) beanNameGenerator));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void customBeanNameGeneratorWithNonWebApplication() throws Exception {
|
|
|
|
|
TestSpringApplication application = new TestSpringApplication(
|
|
|
|
|
ExampleWebConfig.class);
|
|
|
|
|
application.setWebEnvironment(false);
|
|
|
|
|
BeanNameGenerator beanNameGenerator = new DefaultBeanNameGenerator();
|
|
|
|
|
application.setBeanNameGenerator(beanNameGenerator);
|
|
|
|
|
this.context = application.run();
|
|
|
|
|
verify(application.getLoader()).setBeanNameGenerator(beanNameGenerator);
|
|
|
|
|
assertThat(
|
|
|
|
|
this.context
|
|
|
|
|
.getBean(AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR),
|
|
|
|
|
sameInstance((Object) beanNameGenerator));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void commandLinePropertySource() throws Exception {
|
|
|
|
|
SpringApplication application = new SpringApplication(ExampleConfig.class);
|
|
|
|
|