Package org.springframework.context.annotation

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


  @Test
  public void multipleMetaImportsAreProcessed() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(MultiMetaImportConfig.class);
    ctx.refresh();
    assertThat(ctx.containsBean("testBean1"), is(true));
    assertThat(ctx.containsBean("testBean2"), is(true));
  }

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


  public void multipleMetaImportsAreProcessed() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(MultiMetaImportConfig.class);
    ctx.refresh();
    assertThat(ctx.containsBean("testBean1"), is(true));
    assertThat(ctx.containsBean("testBean2"), is(true));
  }

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

  @Test
  public void localAndMetaImportsAreProcessed() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(MultiMetaImportConfigWithLocalImport.class);
    ctx.refresh();
    assertThat(ctx.containsBean("testBean1"), is(true));
    assertThat(ctx.containsBean("testBean2"), is(true));
    assertThat(ctx.containsBean("testBean3"), is(true));
  }

  @Test
View Full Code Here

  public void localAndMetaImportsAreProcessed() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(MultiMetaImportConfigWithLocalImport.class);
    ctx.refresh();
    assertThat(ctx.containsBean("testBean1"), is(true));
    assertThat(ctx.containsBean("testBean2"), is(true));
    assertThat(ctx.containsBean("testBean3"), is(true));
  }

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

    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(MultiMetaImportConfigWithLocalImport.class);
    ctx.refresh();
    assertThat(ctx.containsBean("testBean1"), is(true));
    assertThat(ctx.containsBean("testBean2"), is(true));
    assertThat(ctx.containsBean("testBean3"), is(true));
  }

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

  @Test
  public void localImportIsProcessedLast() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(MultiMetaImportConfigWithLocalImportWithBeanOverride.class);
    ctx.refresh();
    assertThat(ctx.containsBean("testBean1"), is(true));
    assertThat(ctx.containsBean("testBean2"), is(true));
    assertThat(ctx.getBean("testBean2", TestBean.class).getName(), is("2a"));
  }

  @Test
View Full Code Here

  public void localImportIsProcessedLast() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(MultiMetaImportConfigWithLocalImportWithBeanOverride.class);
    ctx.refresh();
    assertThat(ctx.containsBean("testBean1"), is(true));
    assertThat(ctx.containsBean("testBean2"), is(true));
    assertThat(ctx.getBean("testBean2", TestBean.class).getName(), is("2a"));
  }

  @Test
  public void importFromBean() throws Exception {
View Full Code Here

  @Test
  public void importFromBean() throws Exception {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(ImportFromBean.class);
    ctx.refresh();
    assertThat(ctx.containsBean("importAnnotationDetectionTests.ImportFromBean"), is(true));
    assertThat(ctx.containsBean("testBean1"), is(true));
    assertThat(ctx.getBean("testBean1", TestBean.class).getName(), is("1"));
  }

  @Configuration
View Full Code Here

  public void importFromBean() throws Exception {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(ImportFromBean.class);
    ctx.refresh();
    assertThat(ctx.containsBean("importAnnotationDetectionTests.ImportFromBean"), is(true));
    assertThat(ctx.containsBean("testBean1"), is(true));
    assertThat(ctx.getBean("testBean1", TestBean.class).getName(), is("1"));
  }

  @Configuration
  @MetaImport1
View Full Code Here

        return "custom-" + super.generateBeanName(definition, registry);
      }
    });
    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));
  }
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.