Examples of ClassPathXmlApplicationContext


Examples of org.springframework.context.support.ClassPathXmlApplicationContext

            applicationContext.close();
        }
    }

    protected ConfigurableApplicationContext createApplicationContext() {
        return new ClassPathXmlApplicationContext(getApplicationContextXml());
    }
View Full Code Here

Examples of org.springframework.context.support.ClassPathXmlApplicationContext

      "classpath:net/sourceforge/squirrel_sql/client/update/gui/installer/event/net.sourceforge.squirrel_sql.client.update.gui.installer.event.applicationContext.xml",
      "classpath:net/sourceforge/squirrel_sql/client/update/gui/installer/util/net.sourceforge.squirrel_sql.client.update.gui.installer.util.applicationContext.xml",
      "classpath:net/sourceforge/squirrel_sql/client/update/util/net.sourceforge.squirrel_sql.client.update.util.applicationContext.xml"
    };
       
    ApplicationContext ctx = new ClassPathXmlApplicationContext(appCtx);
    return (PreLaunchHelper)ctx.getBean(PreLaunchHelper.class.getName());
  }
View Full Code Here

Examples of org.springframework.context.support.ClassPathXmlApplicationContext

@Test
public class ReconfigProcessorTest {

  public void testGetDefinition() {
    ApplicationContext factory = new ClassPathXmlApplicationContext("/context.xml");
    // two user provider
    assertNotNull((UserDaoProvider) factory.getBean("userDaoProvider"));

    assertNotNull((UserLdapProvider) factory.getBean("userLdapProvider"));

    // userService
    UserService userService = (UserService) factory.getBean("userService");

    assertNotNull(userService);

    assertNotNull(userService.getSomeMap());

    assertEquals(userService.getProvider().getClass(), UserDaoProvider.class);

    // userLdapService
    UserService userLdapService = (UserService) factory.getBean("userLdapService");

    assertNotNull(userLdapService);

    assertEquals(UserLdapProvider.class, userLdapService.getProvider().getClass());
  }
View Full Code Here

Examples of org.springframework.context.support.ClassPathXmlApplicationContext

    assertEquals(UserLdapProvider.class, userLdapService.getProvider().getClass());
  }

  public void testOverride() {
    ApplicationContext factory = new ClassPathXmlApplicationContext("/context-config.xml");
    // userService
    UserService userService = (UserService) factory.getBean("userService");

    assertNotNull(userService);

    // unmerged map
    assertNotNull(userService.getSomeMap());

    assertEquals(1, userService.getSomeMap().size());

    assertEquals(userService.getSomeMap().get("string"), "override string");

    // merged list
    assertEquals(userService.getSomeList().size(), 3);

    // change class
    UserLdapProvider ldapProvider = (UserLdapProvider) factory.getBean("userLdapProvider");
    assertTrue(ldapProvider instanceof AdvancedUserLdapProvider);

    UserService userLdapService = (UserService) factory.getBean("userLdapService");
    assertNotNull(userLdapService);

    assertEquals(AdvancedUserLdapProvider.class, userLdapService.getProvider().getClass());

  }
View Full Code Here

Examples of org.springframework.context.support.ClassPathXmlApplicationContext

public class AutoConfigProcessorTest {

  public void testGet() {
    StopWatch watch = new StopWatch();
    watch.start();
    ApplicationContext factory = new ClassPathXmlApplicationContext("/context-auto.xml");
    testBean(factory);
    testFactoryBean(factory);
    System.out.println("config  context-auto completed using " + watch.getTime());
  }
View Full Code Here

Examples of org.springframework.context.support.ClassPathXmlApplicationContext

  }

  public void testNoAutowire() {
    StopWatch watch = new StopWatch();
    watch.start();
    ApplicationContext factory = new ClassPathXmlApplicationContext("/context-auto.xml");
    String name = SomeAction.class.getName();
    for (int i = 0; i < 100; i++) {
      factory.getBean(name);
    }
    System.out.println("no autowire using " + watch.getTime());
  }
View Full Code Here

Examples of org.springframework.context.support.ClassPathXmlApplicationContext

        }
        catch (FileNotFoundException e ){
            e.printStackTrace(System.out);
        }
        //set the context
        context = new ClassPathXmlApplicationContext(getContextConfigLocation());
        onSetup();
    }
View Full Code Here

Examples of org.springframework.context.support.ClassPathXmlApplicationContext

        } catch (FileNotFoundException e) {
            e.printStackTrace(System.out);
        }

        //set the context
        context = new ClassPathXmlApplicationContext(APP_CONTEXT);

        //set the extractor context
        extractorContext = new ClassPathXmlApplicationContext(TEST_EXTRACTOR_CONTEXT);

        //get the generic case
        ExtractorTestLists tests = (ExtractorTestLists) extractorContext.getBean(
                "extractorTests");
View Full Code Here

Examples of org.springframework.context.support.ClassPathXmlApplicationContext

  public ProcessEngineBuilder(Configuration configuration) {
    this("applicationContext.xml", configuration);
  }
 
  public ProcessEngineBuilder(String springConfigFile, Configuration configuration) {
    this(new ClassPathXmlApplicationContext(springConfigFile), configuration);
  }
View Full Code Here

Examples of org.springframework.context.support.ClassPathXmlApplicationContext

  private ApplicationContext loadApplicationContext(String location) throws Exception {
    String[] locations = new String[2];
    locations[0] = "/org/geomajas/spring/geomajasContext.xml";
    locations[1] = location;
    try {
      return new ClassPathXmlApplicationContext(locations);
    } catch (Exception ex) {
      Throwable ge = ex;
      while (null != ge) {
        if (ge instanceof GeomajasException) {
          throw (GeomajasException)ge;
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.