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:eu.databata.engine.spring.PropagatorSpringExecutor.java

public static void main(String[] args) {
    if (args.length == 0) {
        new ClassPathXmlApplicationContext("WEB-INF/propagator-beans.xml");
    } else if (args.length == 1) {
        new ClassPathXmlApplicationContext(args[0]);
    }//from   w  w  w.  jav a  2  s .  co  m

    LOG.info("\n\nSUCCESS: Propagation finished with no errors.");
    System.out.println("Conf " + args.length + "; " + (args.length > 0 ? args[0] : "sss"));
}

From source file:com.alibaba.dubbo.examples.merge.MergeProvider2.java

public static void main(String[] args) throws Exception {
    String config = MergeProvider2.class.getPackage().getName().replace('.', '/') + "/merge-provider2.xml";
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config);
    context.start();/*from   w ww  .  j  a va2s  . com*/
    System.in.read();
}

From source file:siia.jms.MessageDrivenPojoDemo.java

public static void main(String[] args) {
    // start the context that contains the message-driven POJO
    ApplicationContext context = new ClassPathXmlApplicationContext("siia/jms/message-driven-pojo.xml");

    // send a Message with JmsTemplate
    JmsTemplate jmsTemplate = context.getBean(JmsTemplate.class);
    jmsTemplate.convertAndSend("siia.mdp.queue", "World");
}

From source file:com.alibaba.dubbo.examples.generic.GenericProvider.java

public static void main(String[] args) throws Exception {
    String config = GenericProvider.class.getPackage().getName().replace('.', '/') + "/generic-provider.xml";
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config);
    context.start();//ww  w  . ja v  a2s .  c  om
    System.in.read();
}

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

public static void main(String[] args) throws Exception {
    ApplicationContext context = new ClassPathXmlApplicationContext("/spring/twitter/twitter-inbound.xml");

    Thread.sleep(10 * 60 * 1000);
}

From source file:javaspringtest.JavaSpringTest.java

/**
 * @param args the command line arguments
 *//*from   w w w.  j a  v a2  s .co m*/
public static void main(String[] args) {
    //        Triangle tri = new Triangle();
    //        BeanFactory factory = new XmlBeanFactory(new FileSystemResource("spring.xml"));
    //        Triangle triObj = (Triangle) factory.getBean("triangle");

    //        ApplicationContext context = new ClassPathXmlApplicationContext("file:spring.xml");
    //        file: preffix point to file system resources, not classpath.
    //        file path can be relative or system (/home/user/Work/src...)

    ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");

    Shape shape = (Shape) context.getBean("circle");
    shape.draw();
    //        System.out.println(context.getMessage("greetings", null, "Default Greeting", null)); // key in proprity file, , default msg, location to look for 
}

From source file:com.apress.prospringintegration.concurrency.asyncexample.AsyncExampleApp.java

public static void main(String[] args) throws Exception {
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("async-context.xml");
    AsyncExample asyncExample = ctx.getBean(AsyncExample.class);

    System.out.println("Submitting Job");
    asyncExample.runTask();/*from  w w  w .j a  v  a 2s.  c  o  m*/
    System.out.println("Finish Submitting Job");
}

From source file:com.apress.prospringintegration.gateways.client.MainAsyncGateway.java

public static void main(String[] args) throws Exception {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("gateway-async.xml");

    TicketIssuerAsync ticketIssuerAsync = context.getBean("ticketIssueGatewayAsync", TicketIssuerAsync.class);

    Future<Ticket> result = ticketIssuerAsync.issueTicket(100L);

    Ticket ticket = result.get(1000, TimeUnit.SECONDS);
    System.out.println("Ticket: " + ticket + " was issued on: " + ticket.getIssueDateTime()
            + " with ticket id: " + ticket.getTicketId());
}

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

public static void main(String[] args) throws Exception {
    ApplicationContext context = new ClassPathXmlApplicationContext("/spring/twitter/twitter-dm-inbound.xml");

    Thread.sleep(10 * 60 * 1000);
}

From source file:com.alibaba.dubbo.examples.version.VersionProvider.java

public static void main(String[] args) throws Exception {
    String config = VersionProvider.class.getPackage().getName().replace('.', '/') + "/version-provider.xml";
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config);
    context.start();/*ww w .  j  a v a2s  .c om*/
    System.in.read();
}