Examples of FileSystemXmlApplicationContext


Examples of org.springframework.context.support.FileSystemXmlApplicationContext

public class ParserBeanFactory {
  private static ApplicationContext CONTEXT;

  public static ApplicationContext getContext() {
    if (CONTEXT == null)
      CONTEXT = new FileSystemXmlApplicationContext("beans/parserBeans.xml");
    return CONTEXT;
  }
View Full Code Here

Examples of org.springframework.context.support.FileSystemXmlApplicationContext

public class PropertyPlaceholderTest extends TestCase {

    public void test() throws Throwable {
        System.setProperty("port2", "3333");
       
        FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext(
                "src/test/resources/spring-config/config-property-placeholder.xml");

        DefaultFtpServer server = (DefaultFtpServer) ctx.getBean("server");

        assertEquals(2222, server.getListener("listener0").getPort());
        assertEquals(3333, server.getListener("listener1").getPort());
    }
View Full Code Here

Examples of org.springframework.context.support.FileSystemXmlApplicationContext

  /* (non-Javadoc)
   * @see org.springframework.test.AbstractSpringContextTests#loadContextLocations(java.lang.String[])
   */
  protected ConfigurableApplicationContext loadContextLocations(String[] paths) {
    return new FileSystemXmlApplicationContext(paths);
  }
View Full Code Here

Examples of org.springframework.context.support.FileSystemXmlApplicationContext

    private ApplicationContext getApplicationContext() {
        String[] paths = new String[] {
                "./business/src/resources/applicationContext-db.xml",
                "./business/src/resources/applicationContext.xml" };

        return new FileSystemXmlApplicationContext(paths);
    }
View Full Code Here

Examples of org.springframework.context.support.FileSystemXmlApplicationContext

            throws BeansException {
        ctx = applicationContext;
    }

    public static void main(String[] args) {
        ApplicationContext ctx = new FileSystemXmlApplicationContext(
                "./ch5/src/conf/appContext/aware.xml");
       
        ContextAwareDemo demo = (ContextAwareDemo) ctx.getBean("contextAware");
        demo.displayAppContext();
    }
View Full Code Here

Examples of org.springframework.context.support.FileSystemXmlApplicationContext

* @author robh
*/
public class MessageSourceDemo {

    public static void main(String[] args) {
        ApplicationContext ctx = new FileSystemXmlApplicationContext(
                "./ch5/src/conf/appContext/messageSource.xml");

        Locale english = Locale.ENGLISH;
        Locale czech = new Locale("cs", "CZ");

        System.out.println(ctx.getMessage("msg", null, english));
        System.out.println(ctx.getMessage("msg", null, czech));
       
        System.out.println(ctx.getMessage("nameMsg", new Object[] { "Rob",
                "Harrop" }, english));
    }
View Full Code Here

Examples of org.springframework.context.support.FileSystemXmlApplicationContext

* @author robh
*/
public class LazyInitDemo {

    public static void main(String[] args) {
        ApplicationContext ctx = new FileSystemXmlApplicationContext(
                "./ch5/src/conf/appContext/lazy.xml");

        DestructiveBeanWithInterface bean = (DestructiveBeanWithInterface) ctx
                .getBean("destructiveBean");
    }
View Full Code Here

Examples of org.springframework.context.support.FileSystemXmlApplicationContext

    sender.send(msg);
  }

  public static void main(String[] args) throws Exception {
    ApplicationContext ctx = new FileSystemXmlApplicationContext(
        new String[] { "./ch15/src/conf/simpleHtmlMessageSender.xml",
            "./ch15/src/conf/javaMailSender.xml" });

    SimpleHtmlMessageSender sender = (SimpleHtmlMessageSender) ctx
        .getBean("messageSender");
    sender.sendMessage();
  }
View Full Code Here

Examples of org.xbean.spring.context.FileSystemXmlApplicationContext

                        context = new ClassPathXmlApplicationContext("servicemix.xml", processors);
                    }
                    else {
                        file = args[1];
                        System.out.println("Loading ServiceMix (compatible 1.x) from file: " + file);
                        context = new FileSystemXmlApplicationContext(file, processors);
                    }
                }
                else {
                    System.out.println("Loading ServiceMix from file: " + file);
                    context = new FileSystemXmlApplicationContext(file);
                }
            }
            SpringJBIContainer container = (SpringJBIContainer) context.getBean("jbi");
            Object lock = new Object();
            container.setShutdownLock(lock);
View Full Code Here

Examples of org.xbean.spring.context.FileSystemXmlApplicationContext

        File descriptorFile = new File(tmpDir, DESCRIPTOR_FILE);
        if (descriptorFile.exists()) {
            ClassLoader cl = Thread.currentThread().getContextClassLoader();
            try {
                Thread.currentThread().setContextClassLoader(AutoDeploymentService.class.getClassLoader());
                FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext("file:///"
                        + descriptorFile.getAbsolutePath(),
                        Arrays.asList(new Object[] { new XBeanProcessor()}));
                root = (Descriptor) context.getBean("jbi");
            } finally {
                Thread.currentThread().setContextClassLoader(cl);
            }
        }
        return root;
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.