Package org.springframework.context.annotation

Examples of org.springframework.context.annotation.AnnotationConfigApplicationContext.containsBean()


      }
    });
    ctx.register(A.class);
    ctx.refresh();
    assertThat(ctx.containsBean("custom-outer"), is(true));
    assertThat(ctx.containsBean("custom-imported"), is(true));
    assertThat(ctx.containsBean("custom-nested"), is(true));
    assertThat(ctx.containsBean("nestedBean"), is(true));
  }

  @Configuration("outer")
View Full Code Here


    });
    ctx.register(A.class);
    ctx.refresh();
    assertThat(ctx.containsBean("custom-outer"), is(true));
    assertThat(ctx.containsBean("custom-imported"), is(true));
    assertThat(ctx.containsBean("custom-nested"), is(true));
    assertThat(ctx.containsBean("nestedBean"), is(true));
  }

  @Configuration("outer")
  @Import(C.class)
View Full Code Here

    ctx.register(A.class);
    ctx.refresh();
    assertThat(ctx.containsBean("custom-outer"), is(true));
    assertThat(ctx.containsBean("custom-imported"), is(true));
    assertThat(ctx.containsBean("custom-nested"), is(true));
    assertThat(ctx.containsBean("nestedBean"), is(true));
  }

  @Configuration("outer")
  @Import(C.class)
  static class A {
View Full Code Here

  @Test
  public void customConfigurationStereotype() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(Config.class);
    ctx.refresh();
    assertThat(ctx.containsBean("customName"), is(true));
    TestBean a = ctx.getBean("a", TestBean.class);
    TestBean b = ctx.getBean("b", TestBean.class);
    assertThat(b, sameInstance(a.getSpouse()));
  }
View Full Code Here

  @Test
  public void registerOuterConfig() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(A.class);
    ctx.refresh();
    assertThat(ctx.containsBean("outer"), is(true));
    assertThat(ctx.containsBean("imported"), is(true));
    assertThat(ctx.containsBean("nested"), is(true));
    assertThat(ctx.containsBean("nestedBean"), is(true));
  }
View Full Code Here

  public void registerOuterConfig() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(A.class);
    ctx.refresh();
    assertThat(ctx.containsBean("outer"), is(true));
    assertThat(ctx.containsBean("imported"), is(true));
    assertThat(ctx.containsBean("nested"), is(true));
    assertThat(ctx.containsBean("nestedBean"), is(true));
  }

  @Test
View Full Code Here

    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(A.class);
    ctx.refresh();
    assertThat(ctx.containsBean("outer"), is(true));
    assertThat(ctx.containsBean("imported"), is(true));
    assertThat(ctx.containsBean("nested"), is(true));
    assertThat(ctx.containsBean("nestedBean"), is(true));
  }

  @Test
  public void registerNestedConfig() {
View Full Code Here

    ctx.register(A.class);
    ctx.refresh();
    assertThat(ctx.containsBean("outer"), is(true));
    assertThat(ctx.containsBean("imported"), is(true));
    assertThat(ctx.containsBean("nested"), is(true));
    assertThat(ctx.containsBean("nestedBean"), is(true));
  }

  @Test
  public void registerNestedConfig() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
View Full Code Here

  @Test
  public void registerNestedConfig() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(A.B.class);
    ctx.refresh();
    assertThat(ctx.containsBean("outer"), is(false));
    assertThat(ctx.containsBean("imported"), is(false));
    assertThat(ctx.containsBean("nested"), is(true));
    assertThat(ctx.containsBean("nestedBean"), is(true));
  }
View Full Code Here

  public void registerNestedConfig() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(A.B.class);
    ctx.refresh();
    assertThat(ctx.containsBean("outer"), is(false));
    assertThat(ctx.containsBean("imported"), is(false));
    assertThat(ctx.containsBean("nested"), is(true));
    assertThat(ctx.containsBean("nestedBean"), is(true));
  }

  @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.