Example usage for org.springframework.context.support ClassPathXmlApplicationContext ClassPathXmlApplicationContext

List of usage examples for org.springframework.context.support ClassPathXmlApplicationContext ClassPathXmlApplicationContext

Introduction

In this page you can find the example usage for org.springframework.context.support ClassPathXmlApplicationContext ClassPathXmlApplicationContext.

Prototype

public ClassPathXmlApplicationContext(String... configLocations) throws BeansException 

Source Link

Document

Create a new ClassPathXmlApplicationContext, loading the definitions from the given XML files and automatically refreshing the context.

Usage

From source file:net.freedom.gj.example.Main.java

public static void main(String[] args) {
    try {//from w w  w .j ava2  s  .co  m
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception ex) {
        Logger.getLogger(EmployeeView.class.getName()).log(Level.SEVERE, null, ex);
    }
    System.out.println("Welcome to EL entity mapper demonstration.\n");

    AbstractApplicationContext ctx = new ClassPathXmlApplicationContext(
            new String[] { "net/freedom/gj/example/mapping/mapping-configuration.xml" });

    ctx.registerShutdownHook();

}

From source file:com.roncoo.pay.app.settlement.SettTask.java

public static void main(String[] args) {

    try {/*from   ww w.  j a  va2 s .  c o  m*/

        @SuppressWarnings("resource")
        final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
                new String[] { "spring-context.xml" });
        context.start();
        LOG.debug("");
        SettScheduled settScheduled = (SettScheduled) context.getBean("settScheduled");

        LOG.debug("(??)");
        settScheduled.launchDailySettCollect();
        LOG.debug("(??)?");

        Thread.sleep(MILLIS);

        LOG.debug("()");
        settScheduled.launchAutoSett();
        LOG.debug("()?");

        context.stop();
    } catch (Exception e) {
        LOG.error("SettTask execute error:", e);
    } finally {
        System.exit(0);
        LOG.debug("SettTask Complete");
    }
}

From source file:org.thys.michels.email2sfdc.email.GmailInboundImapIdleAdapterTestApp.java

public static void main(String[] args) throws Exception {
    ApplicationContext context = new ClassPathXmlApplicationContext(
            "/META-INF/spring/integration/gmail-imap-idle-config.xml");

    final ParseEmail parseEmailMessage = new ParseEmail();

    DirectChannel inputChannel = context.getBean("inputChannel", DirectChannel.class);
    inputChannel.subscribe(new MessageHandler() {
        public void handleMessage(Message<?> message) throws MessagingException {
            //logger.info("Message: " + message);
            parseEmailMessage.printMessage(parseEmailMessage.getEmailMessage(message));

        }/*  w ww .jav a  2s  . c om*/
    });
}