Search in sources :

Example 1 with DefaultBeanNameGenerator

use of cn.taketoday.beans.factory.support.DefaultBeanNameGenerator in project today-infrastructure by TAKETODAY.

the class ApplicationTests method customBeanNameGeneratorWithNonWebApplication.

@Test
void customBeanNameGeneratorWithNonWebApplication() {
    TestApplication application = new TestApplication(ExampleWebConfig.class);
    application.setApplicationType(ApplicationType.NONE_WEB);
    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);
}
Also used : BeanNameGenerator(cn.taketoday.beans.factory.support.BeanNameGenerator) DefaultBeanNameGenerator(cn.taketoday.beans.factory.support.DefaultBeanNameGenerator) DefaultBeanNameGenerator(cn.taketoday.beans.factory.support.DefaultBeanNameGenerator) Test(org.junit.jupiter.api.Test)

Example 2 with DefaultBeanNameGenerator

use of cn.taketoday.beans.factory.support.DefaultBeanNameGenerator in project today-infrastructure by TAKETODAY.

the class ApplicationTests method customBeanNameGenerator.

@Test
void customBeanNameGenerator() {
    TestApplication application = new TestApplication(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);
}
Also used : BeanNameGenerator(cn.taketoday.beans.factory.support.BeanNameGenerator) DefaultBeanNameGenerator(cn.taketoday.beans.factory.support.DefaultBeanNameGenerator) DefaultBeanNameGenerator(cn.taketoday.beans.factory.support.DefaultBeanNameGenerator) Test(org.junit.jupiter.api.Test)

Example 3 with DefaultBeanNameGenerator

use of cn.taketoday.beans.factory.support.DefaultBeanNameGenerator in project today-framework by TAKETODAY.

the class ApplicationTests method customBeanNameGenerator.

@Test
void customBeanNameGenerator() {
    TestApplication application = new TestApplication(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);
}
Also used : BeanNameGenerator(cn.taketoday.beans.factory.support.BeanNameGenerator) DefaultBeanNameGenerator(cn.taketoday.beans.factory.support.DefaultBeanNameGenerator) DefaultBeanNameGenerator(cn.taketoday.beans.factory.support.DefaultBeanNameGenerator) Test(org.junit.jupiter.api.Test)

Example 4 with DefaultBeanNameGenerator

use of cn.taketoday.beans.factory.support.DefaultBeanNameGenerator in project today-framework by TAKETODAY.

the class ApplicationTests method customBeanNameGeneratorWithNonWebApplication.

@Test
void customBeanNameGeneratorWithNonWebApplication() {
    TestApplication application = new TestApplication(ExampleWebConfig.class);
    application.setApplicationType(ApplicationType.NONE_WEB);
    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);
}
Also used : BeanNameGenerator(cn.taketoday.beans.factory.support.BeanNameGenerator) DefaultBeanNameGenerator(cn.taketoday.beans.factory.support.DefaultBeanNameGenerator) DefaultBeanNameGenerator(cn.taketoday.beans.factory.support.DefaultBeanNameGenerator) Test(org.junit.jupiter.api.Test)

Aggregations

BeanNameGenerator (cn.taketoday.beans.factory.support.BeanNameGenerator)4 DefaultBeanNameGenerator (cn.taketoday.beans.factory.support.DefaultBeanNameGenerator)4 Test (org.junit.jupiter.api.Test)4