Package org.springframework.context.support

Examples of org.springframework.context.support.ClassPathXmlApplicationContext.containsBean()


  @Test
  public void testClassPathXmlApplicationContext() throws IOException {
    ApplicationContext context = new ClassPathXmlApplicationContext(
        "/org/springframework/web/context/WEB-INF/applicationContext.xml");
    assertTrue("Has father", context.containsBean("father"));
    assertTrue("Has rod", context.containsBean("rod"));
    assertFalse("Hasn't kerry", context.containsBean("kerry"));
    assertTrue("Doesn't have spouse", ((TestBean) context.getBean("rod")).getSpouse() == null);
    assertTrue("myinit not evaluated", "Roderick".equals(((TestBean) context.getBean("rod")).getName()));

    context = new ClassPathXmlApplicationContext(new String[] {
View Full Code Here


  public void testClassPathXmlApplicationContext() throws IOException {
    ApplicationContext context = new ClassPathXmlApplicationContext(
        "/org/springframework/web/context/WEB-INF/applicationContext.xml");
    assertTrue("Has father", context.containsBean("father"));
    assertTrue("Has rod", context.containsBean("rod"));
    assertFalse("Hasn't kerry", context.containsBean("kerry"));
    assertTrue("Doesn't have spouse", ((TestBean) context.getBean("rod")).getSpouse() == null);
    assertTrue("myinit not evaluated", "Roderick".equals(((TestBean) context.getBean("rod")).getName()));

    context = new ClassPathXmlApplicationContext(new String[] {
      "/org/springframework/web/context/WEB-INF/applicationContext.xml",
View Full Code Here

    assertTrue("myinit not evaluated", "Roderick".equals(((TestBean) context.getBean("rod")).getName()));

    context = new ClassPathXmlApplicationContext(new String[] {
      "/org/springframework/web/context/WEB-INF/applicationContext.xml",
      "/org/springframework/web/context/WEB-INF/context-addition.xml" });
    assertTrue("Has father", context.containsBean("father"));
    assertTrue("Has rod", context.containsBean("rod"));
    assertTrue("Has kerry", context.containsBean("kerry"));
  }

  @Test
View Full Code Here

    context = new ClassPathXmlApplicationContext(new String[] {
      "/org/springframework/web/context/WEB-INF/applicationContext.xml",
      "/org/springframework/web/context/WEB-INF/context-addition.xml" });
    assertTrue("Has father", context.containsBean("father"));
    assertTrue("Has rod", context.containsBean("rod"));
    assertTrue("Has kerry", context.containsBean("kerry"));
  }

  @Test
  public void testSingletonDestructionOnStartupFailure() throws IOException {
View Full Code Here

    context = new ClassPathXmlApplicationContext(new String[] {
      "/org/springframework/web/context/WEB-INF/applicationContext.xml",
      "/org/springframework/web/context/WEB-INF/context-addition.xml" });
    assertTrue("Has father", context.containsBean("father"));
    assertTrue("Has rod", context.containsBean("rod"));
    assertTrue("Has kerry", context.containsBean("kerry"));
  }

  @Test
  public void testSingletonDestructionOnStartupFailure() throws IOException {
    try {
View Full Code Here

    ctx.refresh();

    assertEnvironmentBeanRegistered(ctx);
    assertHasEnvironment(ctx, prodEnv);
    assertEnvironmentAwareInvoked(ctx, ctx.getEnvironment());
    assertThat(ctx.containsBean(DEV_BEAN_NAME), is(false));
    assertThat(ctx.containsBean(PROD_BEAN_NAME), is(true));
  }

  @Test
  public void fileSystemXmlApplicationContext() throws IOException {
View Full Code Here

    assertEnvironmentBeanRegistered(ctx);
    assertHasEnvironment(ctx, prodEnv);
    assertEnvironmentAwareInvoked(ctx, ctx.getEnvironment());
    assertThat(ctx.containsBean(DEV_BEAN_NAME), is(false));
    assertThat(ctx.containsBean(PROD_BEAN_NAME), is(true));
  }

  @Test
  public void fileSystemXmlApplicationContext() throws IOException {
    ClassPathResource xml = new ClassPathResource(XML_PATH);
View Full Code Here


  @Test
  public void aspectjTypeFilter() {
    ClassPathXmlApplicationContext context = loadContext("aspectjTypeFilterTests.xml");
    assertTrue(context.containsBean("fooServiceImpl"));
    assertTrue(context.containsBean("stubFooDao"));
    assertFalse(context.containsBean("scopedProxyTestBean"));
    context.close();
  }
View Full Code Here

  @Test
  public void aspectjTypeFilter() {
    ClassPathXmlApplicationContext context = loadContext("aspectjTypeFilterTests.xml");
    assertTrue(context.containsBean("fooServiceImpl"));
    assertTrue(context.containsBean("stubFooDao"));
    assertFalse(context.containsBean("scopedProxyTestBean"));
    context.close();
  }

  @Test
View Full Code Here

  @Test
  public void aspectjTypeFilter() {
    ClassPathXmlApplicationContext context = loadContext("aspectjTypeFilterTests.xml");
    assertTrue(context.containsBean("fooServiceImpl"));
    assertTrue(context.containsBean("stubFooDao"));
    assertFalse(context.containsBean("scopedProxyTestBean"));
    context.close();
  }

  @Test
  public void aspectjTypeFilterWithPlaceholders() {
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.