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[] paths, Class<?> clazz) 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:ru.retbansk.mail.Main.java

/**
 * @param args/*from w  w  w  . j a v a  2s. com*/
 */
public static void main(String[] args) {

    new ClassPathXmlApplicationContext("scheduledConfig.xml", Main.class);

}

From source file:org.springone2gx_2011.integration.gatewaywithtimeout.EchoGatewayDemo.java

/**
 * @param args/*  w  ww  .j  a  v  a2 s . c  om*/
 */
public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("gateway-with-timeout-config.xml",
            EchoGatewayDemo.class);
    final EchoGateway gateway = context.getBean(EchoGateway.class);
    System.out.println(gateway.echo("foo"));
    System.out.println(gateway.echo("bar"));
}

From source file:com.apress.prospringintegration.social.mail.SmtpMail.java

public static void main(String[] args) {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/spring/mail/smtp-mail.xml",
            SmtpMail.class);

    MessageChannel input = context.getBean("input", MessageChannel.class);

    Message<String> message = MessageBuilder.withPayload("This is a test").build();
    input.send(message);/*from www .  j  av a  2  s.  c om*/

    context.stop();
}

From source file:org.springintegration.SpringIntegrationTest.java

public static void main(String[] args) throws Exception {

    ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(
            "/META-INF/spring/integration/spring-integration-context.xml", SpringIntegrationTest.class);
    System.out.println("Hit Enter to terminate");
    System.in.read();// ww  w  .  j a v  a2s  . c  o  m
    context.close();
}

From source file:com.apress.prospringintegration.social.xmpp.XmppOutbound.java

public static void main(String[] args) {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
            "/spring/xmpp/xmpp-outbound.xml", XmppOutbound.class);

    MessageChannel input = context.getBean("input", MessageChannel.class);

    Message<String> message = MessageBuilder.withPayload("This is a test").build();
    input.send(message);/*from w w  w.jav  a 2s . c o m*/

    context.stop();
}

From source file:siia.monitoring.wiretap.WireTapDemo.java

public static void main(String[] args) {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("context.xml",
            WireTapDemo.class);
    MessageChannel debitChannel = context.getBean("debitChannel", MessageChannel.class);
    Message<Debit> message1 = MessageBuilder.withPayload(new Debit(new BigDecimal(5000), "SMALL")).build();
    Message<Debit> message2 = MessageBuilder.withPayload(new Debit(new BigDecimal(25000), "BIG")).build();
    debitChannel.send(message1);/* w  w  w.  jav a2 s . c o m*/
    debitChannel.send(message2);
}

From source file:com.apress.prospringintegration.social.twitter.TwitterOutbound.java

public static void main(String[] args) {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
            "/spring/twitter/twitter-outbound.xml", TwitterOutbound.class);

    MessageChannel input = context.getBean("twitterOutbound", MessageChannel.class);

    Message<String> message = MessageBuilder
            .withPayload("Only can send message once " + Calendar.getInstance().getTimeInMillis()).build();
    input.send(message);/*  w w w  . j a  v a  2s.  c o m*/

    context.stop();
}

From source file:com.hadoop.wordcount.Wordcount.java

public static void main(String[] args) throws Exception {
    AbstractApplicationContext context = new ClassPathXmlApplicationContext(
            "/META-INF/spring/application-context.xml", Wordcount.class);
    log.info("Streaming Application Running");
    context.registerShutdownHook();// w  w  w .j  a  v a 2  s  .com
}

From source file:com.springdeveloper.hadoop.TweetCount.java

public static void main(String[] args) throws Exception {
    AbstractApplicationContext context = new ClassPathXmlApplicationContext(
            "/META-INF/spring/application-context.xml", TweetCount.class);
    log.info("TweetCount Application Running");
    context.registerShutdownHook();//from w  w w  .  j a va2 s  . c  om
}

From source file:com.oreilly.springdata.hadoop.pig.PigApp.java

public static void main(String[] args) throws Exception {
    AbstractApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/pig-context.xml",
            PigApp.class);
    log.info("Pig Application Running");
    context.registerShutdownHook();/*from  w w  w  . ja  va 2  s  . c  o m*/

}