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:biz.c24.io.spring.integration.samples.fpml.PreRenderingDataGeneratorMain.java

/**
 * @param args/*from ww  w  .  j ava 2  s.  c  o m*/
 */
public static void main(String[] args) {

    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
            "classpath:/biz/c24/io/spring/integration/samples/fpml/generator/prerender-si-context.xml");

    context.registerShutdownHook();

}

From source file:com.github.ffremont.SpringBatchApplication.java

/**
 * @param args the command line arguments
 *///from w  ww .  j  a va 2  s .c o m
public static void main(String[] args) {
    ClassPathXmlApplicationContext cpt = new ClassPathXmlApplicationContext("simple-job.xml");
    cpt.start();
    JobLauncher jobLauncher = (JobLauncher) cpt.getBean("jobLauncher");
    Job job = (Job) cpt.getBean("partitionSimpleStepJob");

    JobParameters parameter = new JobParametersBuilder().addDate("date", new Date()).toJobParameters();

    try {
        jobLauncher.run(job, parameter);
    } catch (JobExecutionException ex) {
        LOG.error("Oups", ex);
    }
}

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

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

    TicketIssuer ticketIssuer = context.getBean("ticketIssueGateway", TicketIssuer.class);

    Ticket ticket = ticketIssuer.issueTicket(100L);
    System.out.println("Ticket: " + ticket + " was issued on: " + ticket.getIssueDateTime()
            + " with ticket id: " + ticket.getTicketId());
}

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

public static void main(String[] args) {
    new ClassPathXmlApplicationContext("classpath:spring-provider.xml");
}

From source file:org.camelcookbook.structuringroutes.simplespring.SpringCamelApplication.java

public static void main(String[] args) throws InterruptedException {
    ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(
            "META-INF/spring/simplespring-context.xml");
    applicationContext.start();//from   w  w w  .  jav  a2 s . c o  m

    // let the Camel runtime do its job for 5 seconds
    Thread.sleep(5000);

    // shutdown
    applicationContext.stop();
}

From source file:org.gflogger.perftest.SpringTest.java

public static void main(String[] args) throws Throwable {
    final SpringTest springTest = new SpringTest();
    final ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:app-context.xml");
    ctx.start();/*from www  .ja va2 s .c  om*/

    springTest.test();

    ctx.stop();
}

From source file:org.devware.batch.main.Launcher.java

public static void main(String arg[]) {

    String[] springConfig = { "org/devware/config/context/readerConfig.xml",
            "org/devware/config/context/writerConfig.xml", "org/devware/config/context/processorConfig.xml",
            "org/devware/config/datasource/datasource.xml" };

    ApplicationContext context = new ClassPathXmlApplicationContext(springConfig);

    JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher");

    Job job = (Job) context.getBean("ExcelReaderJob");

    try {//from  ww w .  jav  a  2 s  .c  o m
        JobExecution execution = jobLauncher.run(job, new JobParameters());

        System.out.println("Exit Status : " + execution.getStatus());
    } catch (Exception e) {
        //  
        e.printStackTrace();
    }

    System.out.println("Done");

}

From source file:org.camelcookbook.structuringroutes.simplespring.SpringJavaDslApplication.java

public static void main(String[] args) throws InterruptedException {
    ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(
            "META-INF/spring/simplespring-java-context.xml");
    applicationContext.start();/* w  w  w.  ja  v  a  2s  .co m*/

    // let the Camel runtime do its job for 5 seconds
    Thread.sleep(5000);

    // shutdown
    applicationContext.stop();
}

From source file:samples.ConsumerApplication.java

public static void main(String[] args) {
    AbstractApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
    context.registerShutdownHook();/* w  ww  . j  av  a2 s.c o m*/

    boolean sync = true;
    if (args != null && args.length > 0) {
        sync = Boolean.valueOf(args[0]);
    }

    if (sync == true) {
        //Example of a sync consumer with Spring JMS
        SpringJmsConsumer consumer = (SpringJmsConsumer) context.getBean("springJmsConsumer");
        consumer.run();
        ((org.springframework.jms.connection.CachingConnectionFactory) context.getBean("connectionFactory"))
                .resetConnection();
    } else {
        //Example of an async consumer with Spring JMS (autoStartup is normally set to true)
        AbstractJmsListeningContainer listenerContainer = (AbstractJmsListeningContainer) context
                .getBean("listenerContainer");
        listenerContainer.start();
    }
}

From source file:com.dangdang.example.elasticjob.spring.main.SpringJobMainWthListener.java

@SuppressWarnings("resource")
public static void main(final String[] args) {
    // CHECKSTYLE:ON
    new ClassPathXmlApplicationContext("classpath:META-INF/withNamespaceAndListener.xml");
}