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.faisal.Test.java

License:asdf

public static void main(String[] args) {
    ClassPathXmlApplicationContext cpac = new ClassPathXmlApplicationContext("mytest-spring.xml");
    CustomerDAOImpl impl = cpac.getBean("customerDAO", CustomerDAOImpl.class);
    Customer customer = createDummyCustomer();
    impl.create(customer);//  w w  w .  jav a 2  s.  co m
}

From source file:springaop.AopMain.java

/**
 * @param args the command line arguments
 *///from w  w  w .ja  va2  s.c o m
public static void main(String[] args) {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("spring.xml");
    ShapeService shapeService = ctx.getBean("shapeService", ShapeService.class);
    shapeService.getCircle();

}

From source file:es.udc.fic.medregatas.MyApplication.java

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

    ApplicationContext context = new ClassPathXmlApplicationContext("classpath:/spring-config.xml");
    final MainAppjFrame mainAppjFrame = new MainAppjFrame(context);

    /* Create and display the form */
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            mainAppjFrame.setLocationRelativeTo(null);
            mainAppjFrame.setVisible(true);
        }/*from  w  w w.  j  a  v a 2 s .c o  m*/
    });
}

From source file:com.lnu.agile.test.MailTest.java

@SuppressWarnings("resource")
public static void main(String args[]) {

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

    //Get the mailer instance
    ApplicationMailer mailer = (ApplicationMailer) context.getBean("mailService");

    //Send a composed mail
    mailer.sendMail("xuebo.sun@gmail.com", "Test Subject", "Testing body");
    System.out.println("good");
}

From source file:firstspring.FIRSTSPRING.java

/**
 * @param args the command line arguments
 *///from   w  ww.  ja  v  a  2  s. c o  m
public static void main(String[] args) {
    final AbstractApplicationContext ctx = new ClassPathXmlApplicationContext(
            new String[] { "applicationContext.xml" });

    OwnerService owner = (OwnerService) ctx.getBean("owner");
    Animal pet = owner.getPet();
    pet.speak();
}

From source file:com.engine.test.Starter.java

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("pipelineConfig.xml");
    PipelineManager pipeline = (PipelineManager) context.getBean(PipelineManager.class);

    String[] docArray = { "This is doc 1", "Another document" };

    for (String doc : docArray) {
        InputDocument in = new InputDocument();
        in.setCnt(doc);//w  ww  . j av  a  2  s.  co  m
        pipeline.doAction(in);
    }

}

From source file:com.home.ln_spring.ch5.event.ResourceDemo.java

public static void main(String[] args) throws Exception {
    ApplicationContext ac = new ClassPathXmlApplicationContext("classpath:events/events.xml");

    Resource res1 = ac.getResource("file:/home/vitaliy/NetBeansProjects/Ln_Spring/src/main/resources/test.txt");
    displayInfo(res1);//from  w  ww .j a v a  2s. c  o  m

    Resource res2 = ac.getResource("classpath:test.txt");
    displayInfo(res2);

    Resource res3 = ac.getResource("http://www.google.com");
    displayInfo(res3);

}

From source file:Server.Server.java

/**
 * @param args the command line arguments
 *///from  w w  w.  jav a 2 s  . co  m
public static void main(String[] args) {
    // TODO code application logic here

    ApplicationContext context = new ClassPathXmlApplicationContext("Classes/bean.xml");
    System.out.println("Waiting for requests");
}

From source file:com.tsguild.flooringmastery.FlooringMasteryApp.java

public static void main(String[] args) {

    ApplicationContext springFactory = new ClassPathXmlApplicationContext("applicationContext.xml");

    FlooringMasteryController controller = springFactory.getBean("controller", FlooringMasteryController.class);
    controller.run();//ww  w.j  a  v a  2  s . c  o  m

}

From source file:edu.eci.cosw.polizas.logica.Test.java

public static void main(String ap[]) {
    ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
    OperationsFacade f = ac.getBean(OperationsFacade.class);
    Cliente c = f.getClient(1, "cc");
    System.out.println(c.getNombre());
    System.out.println(c.getPolizasAprobadases().iterator().next());

}