Search in sources :

Example 26 with ApplicationContext

use of cn.taketoday.context.ApplicationContext in project today-infrastructure by TAKETODAY.

the class Spr11310Tests method orderedList.

@Test
public void orderedList() {
    ApplicationContext context = new StandardApplicationContext(Config.class);
    StringHolder holder = context.getBean(StringHolder.class);
    assertThat(holder.itemsList.get(0)).isEqualTo("second");
    assertThat(holder.itemsList.get(1)).isEqualTo("first");
    assertThat(holder.itemsList.get(2)).isEqualTo("unknownOrder");
}
Also used : StandardApplicationContext(cn.taketoday.context.support.StandardApplicationContext) ApplicationContext(cn.taketoday.context.ApplicationContext) StandardApplicationContext(cn.taketoday.context.support.StandardApplicationContext) Test(org.junit.jupiter.api.Test)

Example 27 with ApplicationContext

use of cn.taketoday.context.ApplicationContext in project today-infrastructure by TAKETODAY.

the class Spr11310Tests method orderedArray.

@Test
public void orderedArray() {
    ApplicationContext context = new StandardApplicationContext(Config.class);
    StringHolder holder = context.getBean(StringHolder.class);
    assertThat(holder.itemsArray[0]).isEqualTo("second");
    assertThat(holder.itemsArray[1]).isEqualTo("first");
    assertThat(holder.itemsArray[2]).isEqualTo("unknownOrder");
}
Also used : StandardApplicationContext(cn.taketoday.context.support.StandardApplicationContext) ApplicationContext(cn.taketoday.context.ApplicationContext) StandardApplicationContext(cn.taketoday.context.support.StandardApplicationContext) Test(org.junit.jupiter.api.Test)

Example 28 with ApplicationContext

use of cn.taketoday.context.ApplicationContext in project today-infrastructure by TAKETODAY.

the class Spr15275Tests method testWithAbstractFactoryBean.

@Test
public void testWithAbstractFactoryBean() {
    ApplicationContext context = new StandardApplicationContext(ConfigWithAbstractFactoryBean.class);
    assertThat(context.getBean(Bar.class).foo.toString()).isEqualTo("x");
    assertThat(context.getBean(Bar.class).foo).isSameAs(context.getBean(FooInterface.class));
}
Also used : StandardApplicationContext(cn.taketoday.context.support.StandardApplicationContext) ApplicationContext(cn.taketoday.context.ApplicationContext) StandardApplicationContext(cn.taketoday.context.support.StandardApplicationContext) Test(org.junit.jupiter.api.Test)

Example 29 with ApplicationContext

use of cn.taketoday.context.ApplicationContext in project today-infrastructure by TAKETODAY.

the class Spr15275Tests method testWithAbstractFactoryBeanForInterface.

@Test
public void testWithAbstractFactoryBeanForInterface() {
    ApplicationContext context = new StandardApplicationContext(ConfigWithAbstractFactoryBeanForInterface.class);
    assertThat(context.getBean(Bar.class).foo.toString()).isEqualTo("x");
    assertThat(context.getBean(Bar.class).foo).isSameAs(context.getBean(FooInterface.class));
}
Also used : StandardApplicationContext(cn.taketoday.context.support.StandardApplicationContext) ApplicationContext(cn.taketoday.context.ApplicationContext) StandardApplicationContext(cn.taketoday.context.support.StandardApplicationContext) Test(org.junit.jupiter.api.Test)

Example 30 with ApplicationContext

use of cn.taketoday.context.ApplicationContext in project today-infrastructure by TAKETODAY.

the class Spr11202Tests method testWithoutImporter.

@Test
public void testWithoutImporter() {
    ApplicationContext context = new StandardApplicationContext(Config.class);
    assertThat(context.getBean("value")).isEqualTo("foo");
}
Also used : StandardApplicationContext(cn.taketoday.context.support.StandardApplicationContext) ApplicationContext(cn.taketoday.context.ApplicationContext) StandardApplicationContext(cn.taketoday.context.support.StandardApplicationContext) Test(org.junit.jupiter.api.Test)

Aggregations

ApplicationContext (cn.taketoday.context.ApplicationContext)200 Test (org.junit.jupiter.api.Test)158 StandardApplicationContext (cn.taketoday.context.support.StandardApplicationContext)44 ConfigurableApplicationContext (cn.taketoday.context.ConfigurableApplicationContext)29 AnnotationConfigApplicationContext (cn.taketoday.context.annotation.AnnotationConfigApplicationContext)24 GenericWebServletApplicationContext (cn.taketoday.web.context.support.GenericWebServletApplicationContext)22 TestBean (cn.taketoday.beans.testfixture.beans.TestBean)14 ClassPathXmlApplicationContext (cn.taketoday.context.support.ClassPathXmlApplicationContext)12 ITestBean (cn.taketoday.beans.testfixture.beans.ITestBean)10 WebServletApplicationContext (cn.taketoday.web.servlet.WebServletApplicationContext)8 GenericApplicationContext (cn.taketoday.context.support.GenericApplicationContext)6 ConfigurableEnvironment (cn.taketoday.core.env.ConfigurableEnvironment)6 PropertySources (cn.taketoday.core.env.PropertySources)6 Resource (cn.taketoday.core.io.Resource)6 Nullable (cn.taketoday.lang.Nullable)6 FooService (example.scannable.FooService)6 ServletContext (jakarta.servlet.ServletContext)6 WebApplicationContext (cn.taketoday.web.WebApplicationContext)5 AutowireCapableBeanFactory (cn.taketoday.beans.factory.config.AutowireCapableBeanFactory)4 Advised (cn.taketoday.aop.framework.Advised)3