List of usage examples for org.springframework.context.support GenericXmlApplicationContext GenericXmlApplicationContext
public GenericXmlApplicationContext(String... resourceLocations)
From source file:de.visualdependencies.context.ContextUtil.java
/** * Creates and return a new Spring context object. * /* w w w.ja va 2 s. co m*/ * This creates a complete new context including data abstraction layer and plugin management. All plugins defined * in the application's package will recognized. * * @return applicationContext */ public static GenericApplicationContext initialize() { // Creating the context for database configuration. final GenericXmlApplicationContext contextDatabase = new GenericXmlApplicationContext( "classpath:context-database.xml"); final GenericApplicationContext context = new GenericApplicationContext(contextDatabase); context.refresh(); return context; }
From source file:org.cloudfoundry.identity.api.BootstrapTests.java
@Test public void testRootContext() throws Exception { GenericXmlApplicationContext context = new GenericXmlApplicationContext( new FileSystemResource("src/main/webapp/WEB-INF/spring-servlet.xml")); context.close();/*from w ww .j a v a2 s . c o m*/ }
From source file:test.TimeTests.java
@Test public void testVanillaApplication() { new GenericXmlApplicationContext("file:source/time.xml").close(); }
From source file:com.gendevs.bedrock.appengine.repository.RepositoryFactory.java
private ApplicationContext getContext() { if (context == null) { context = new GenericXmlApplicationContext("SpringConfig.xml"); GDLogger.logInfo("BaseService", "initialized SpringConfig"); }/*from ww w .ja va 2 s . c om*/ return context; }
From source file:org.crsh.spring.SpringTestCase.java
public void testFoo() throws Exception { URL xml = SpringTestCase.class.getResource("spring.xml"); Assert.assertNotNull(xml);// w w w . ja va2 s .co m // GenericXmlApplicationContext context = new GenericXmlApplicationContext(new UrlResource(xml)); context.start(); // SpringBootstrap bootstrap = context.getBean(SpringBootstrap.class); // Test a bit ShellFactory factory = bootstrap.getContext().getPlugin(ShellFactory.class); Shell shell = factory.create(null); assertNotNull(shell); ShellProcess process = shell.createProcess("foo_cmd"); assertNotNull(process); BaseProcessContext pc = BaseProcessContext.create(process).execute(); assertTrue(pc.getResponse() instanceof ShellResponse.Ok); String r = pc.getOutput(); assertEquals("bar", r); }
From source file:edu.colorado.orcid.TestSpringContext.java
@Test public void testLoadContext() throws Exception { GenericXmlApplicationContext context = new GenericXmlApplicationContext( new FileSystemResource("src/main/webapp/WEB-INF/spring-servlet.xml")); context.close();/*from w w w . ja v a 2 s.c o m*/ }
From source file:net.sf.jsog.spring.ns.UrlBeanDefinitionParserTest.java
@Test public void test() { ApplicationContext ac = new GenericXmlApplicationContext( new ClassPathResource("net/sf/jsog/spring/ns/url.xml")); UrlBuilder url = ac.getBean(UrlBuilder.class); assertNotNull(url);/*w w w . j a v a2 s . c o m*/ assertEquals("http://www.example.com/?foo=bar&foo=baz&qux=quux", url.toString()); }
From source file:com.jeffrodriguez.webtools.spring.ns.UrlBeanDefinitionParserTest.java
@Test public void test() { ApplicationContext ac = new GenericXmlApplicationContext( new ClassPathResource("com/jeffrodriguez/webtools/spring/ns/url.xml")); UrlBuilder url = ac.getBean(UrlBuilder.class); assertNotNull(url);//from w w w. j a v a 2 s . c om assertEquals("http://www.example.com/?foo=bar&foo=baz&qux=quux", url.toString()); }
From source file:test.org.tradex.camel.TestCaseAppContextBuilder.java
/** * Creates a new application context using the file found at <code>ROOT_RESOURCE_DIR + clazz.getPackageName + fileName</code> * @param fileName The filename in the calculated directory * @param clazz The clazz we're launching the app context for * @return the app context/* www . j a va 2 s.co m*/ */ public static GenericXmlApplicationContext buildFor(String fileName, Class<?> clazz) { if (clazz == null) throw new IllegalArgumentException("Passed class was null", new Throwable()); File springXml = new File( ROOT_RESOURCE_DIR + clazz.getPackage().getName().replace('.', '/') + "/" + fileName); if (!springXml.canRead()) { throw new RuntimeException("Failed to read Spring XML file at [" + springXml + "]", new Throwable()); } return service(new GenericXmlApplicationContext( new FileSystemResource[] { new FileSystemResource(springXml.getAbsoluteFile()) })); }
From source file:acromusashi.stream.helper.SpringContextHelper.java
/** * BeanFactory??<br>//from ww w . j a v a 2s. c o m * ?Context?????????Context??BeanFactory??<br> * ????????Context???? * * @return BeanFactory */ protected BeanFactory getBeanFactory() { if (this.appContext == null) { this.appContext = new GenericXmlApplicationContext(this.appContextPath); } return this.appContext.getBeanFactory(); }