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:de.iritgo.nexim.App.java

public static void main(String[] args) {
    ApplicationContext appContext = new ClassPathXmlApplicationContext("nexim.spring.xml");
    @SuppressWarnings("unused")
    IMServer imServer = (IMServer) appContext.getBean("de.iritgo.nexim.IMServer");
}

From source file:edu.berkeley.path.next.decisionService.DecisionServiceApp.java

public static void main(String[] args) {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
            "decisionService-subscribe.xml");
    context.start();/*w w  w.  ja  va 2 s  . c  o m*/

}

From source file:com.apress.prospringintegration.ftp.FtpOutbound.java

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("/spring/ftp/ftp-outbound-context.xml");
    MessageChannel ftpChannel = context.getBean("ftpChannel", MessageChannel.class);
    File file = new File("readme.txt");
    Message<File> message = MessageBuilder.withPayload(file).build();
    ftpChannel.send(message);//  www.  jav  a 2  s  .  c  om
}

From source file:com.apress.prospringintegration.ftp.SftpOutbound.java

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("/spring/ftp/sftp-outbound-context.xml");
    MessageChannel ftpChannel = context.getBean("ftpChannel", MessageChannel.class);
    File file = new File("readme.txt");
    Message<File> message = MessageBuilder.withPayload(file).build();
    ftpChannel.send(message);// w ww .  j  a  v  a2 s . co  m
}

From source file:com.shopzilla.api.driver.ProductServiceDriver.java

public static void main(String[] args) throws JAXBException, IOException {

    ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
            "classpath:applicationContext.xml");
    ProductService service = applicationContext.getBean("productService", ProductService.class);

    //service.xmlInputStreamToJava();
}

From source file:siia.jms.ChannelAdapterDemo.java

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("siia/jms/channel-adapters.xml");
    MessageChannel toJMS = context.getBean("toJMS", MessageChannel.class);
    PollableChannel fromJMS = context.getBean("fromJMS", PollableChannel.class);
    MessagingTemplate template = new MessagingTemplate();
    template.convertAndSend(toJMS, "echo");
    Object response = template.receiveAndConvert(fromJMS);
    System.out.println("response: " + response);
}

From source file:com.joshlong.activiti.coordinator.registration1.distribution.consumer.RegistrationConsumerMain.java

public static void main(String[] args) throws Throwable {
    ClassPathXmlApplicationContext cax = new ClassPathXmlApplicationContext("consumer.xml");

    Thread.sleep(1000 * 30);//from   w  w  w. j  ava2 s  . co m

}

From source file:com.jatin.auto.imdg.node.Main.java

public static void main(String args[]) {

    ApplicationContext context = new ClassPathXmlApplicationContext("app-context.xml");

    CustomerService customerService = context.getBean(CustomerService.class);

    log.info("Retrieving objects not in cache...");
    for (long i = 1; i <= 2; i++) {
        log.info("Retrieving object with id: " + i);
        Customer c = customerService.findCustomer(i);
        log.info("Retrieved " + c.getFirstname() + " " + c.getLastname());
    }/*  w  w  w  .  j av a  2  s. com*/

    log.info("Retrieving the same objects again. This time, the target method is not actually invoked!");
    log.info("@Cacheable causes Spring to wrap CustomerService in a proxy: "
            + customerService.getClass().getName());

    for (int i = 1; i <= 2; i++) {
        log.info("Retrieving object with id: " + i);
        Customer c = customerService.findCustomer(i);
        log.info("Retrieved " + c.getFirstname() + " " + c.getLastname());
    }
}

From source file:org.jupiter.example.spring.JupiterClient.java

public static void main(String[] args) {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:spring-consumer.xml");
    ServiceTest service = ctx.getBean(ServiceTest.class);
    try {//from w  ww  . j  a v a 2 s  . co m
        ServiceTest.ResultClass result1 = service.sayHello();
        System.out.println(result1);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:be.functor.cycloscan.CycloScan.java

public static void main(final String[] args) {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("context/application-context.xml");

    while (true) {
        Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
    }/*from   www  .  j av a2  s.c  om*/
}