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:com.apress.prospringintegration.monitoring.MonitoringExample.java

public static void main(String[] args) {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
            "classpath:monitoring/monitoring.xml");

    ProcessMessage processMessage = context.getBean("processMessage", ProcessMessage.class);
    for (int i = 0; i < 10; i++) {
        processMessage.processMessage("Process");
        processMessage.checkMessage("Check");
    }//from  ww w . j ava2  s  .  c  o  m

    while (true) {
        try {
            Thread.sleep(60000);
        } catch (InterruptedException e) {
            //do nothing
        }
        context.stop();
    }
}

From source file:com.apress.prospringintegration.file.FileRegexCopy.java

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("spring/file/file-regex-context.xml");
}

From source file:org.springforpro.chptr5.event.Publisher.java

public static void main(String[] args) {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:events/events.xml");
    Publisher pub = ctx.getBean("publisher", Publisher.class);
    pub.publish("Hello world! Amigo!");
    pub.publish("The fast quick brown fox jumped over the lazy dog!");
}

From source file:com.gvmax.smtp.SMTPMain.java

@SuppressWarnings("resource")
public static void main(String[] args) {
    logger.info("Starting SMTP Server");
    new ClassPathXmlApplicationContext("/server-smtp-context.xml");
}

From source file:com.zuoxiaolong.niubi.job.example.spring.Test.java

public static void main(String[] args) {
    new ClassPathXmlApplicationContext("applicationContext.xml");
}

From source file:be.anova.course.camel.beans.Main.java

public static void main(String[] args) {
    try {//from  w  w  w  .  j a  v a 2 s. c  o  m
        ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
        Thread.sleep(60000);
    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:com.apress.prospringintegration.file.FileGatewayCopy.java

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("spring/file/file-gateway-context.xml");
}

From source file:com.apress.prospringintegration.file.FilePatternCopy.java

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("spring/file/file-pattern-context.xml");
}

From source file:com.plugtree.spotplug.impl.Server.java

public static void main(String[] args) {

    ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "/core.xml" });//, "/connection.xml"

    Configuration configuration = (Configuration) context.getBean("Configuration");

    EventInputManager eventInputManager = configuration.getEventInputManager();
    configuration.configure();//from w  ww . j av  a2s  .  c  om
    eventInputManager.start();
}

From source file:be.anova.course.camel.basic.Main.java

public static void main(String[] args) {
    try {/*ww  w.j a  v  a 2  s  .  c om*/
        ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");

        Thread.sleep(60000);
    } catch (Exception e) {
        e.printStackTrace();
    }

}