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:siia.twitter.SearchToLog.java

public static void main(String[] args) {
    new ClassPathXmlApplicationContext("siia/twitter/search-to-log.xml");
}

From source file:pl.edu.amu.wmi.bank.Bank.java

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

    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

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

    SendPublicKeyService keySender = (SendPublicKeyService) context.getBean("sendPublicKeyToShopService");

    keySender.sendPublicKey();/*  w ww  . j av  a  2  s .c  o m*/

    Accounts accounts = (Accounts) context.getBean("accounts");

    System.out.println(accounts);

    while (true) {
        System.out.println("Wcisnij cokolwiek zeby ponownie wyslac klucz");
        reader.readLine();
        keySender.sendPublicKey();
    }

}

From source file:siia.twitter.TimelineToLog.java

public static void main(String[] args) {
    new ClassPathXmlApplicationContext("siia/twitter/timeline-to-log.xml");
}

From source file:siia.twitter.SearchAnalysis.java

public static void main(String[] args) {
    new ClassPathXmlApplicationContext("siia/twitter/search-analysis.xml");
}

From source file:com.aan.girsang.server.launcher.GenerateDatabase.java

public static void main(String[] args) throws SQLException {
    AbstractApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");

    DataSource dataSource = (DataSource) ctx.getBean("dataSource");

    Configuration cfg = new AnnotationConfiguration().configure("hibernate.cfg.xml")
            .setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");

    try (Connection conn = dataSource.getConnection()) {
        new SchemaExport(cfg, conn).create(true, true);

        cfg.generateSchemaCreationScript(Dialect.getDialect(cfg.getProperties()));
        SchemaExport export = new SchemaExport(cfg, conn);
        export.create(true, true);/*w w w  .j  a  v  a 2 s .co m*/

        conn.close();

    }
    ctx.registerShutdownHook();

}

From source file:org.jmangos.sniffer.Sniffer.java

/**
 * Main startup method/*w w w.j  a va2s.  c  om*/
 * 
 * @param args
 *        ignored
 */
@SuppressWarnings("resource")
public static void main(final String[] args) {
    new ClassPathXmlApplicationContext(new String[] { "classpath:/META-INF/applicationContext.xml" });
}

From source file:samples.EchoSample.java

public static void main(String args[]) throws Exception {
    new ClassPathXmlApplicationContext("samples/EchoSample-*.xml");
}

From source file:co.com.edu.udea.micine.temp.index.java

public static void main(String[] args) {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
            "co/com/edu/udea/micine/util/springConf.xml");
    Tipooperador to = new Tipooperador();
    to.setIdTipoOperador(1);/* ww w . j av  a2s .com*/

    Cine c = new Cine();
    c.setIdCine(1);
    /*  c.setNombre("monterey");
    c.setCiudad("medellin");
    c.setTelefono("387383");
    ICineDAO cineDAO = context.getBean(CineDAOImpl.class);
    cineDAO.guardarCine(c);
            
    Operador o = new Operador();
    o.setCine(c);
    o.setContrasena("1234");
    o.setNombre("DANIEL");
    o.setNombreUsuario("daniel");*/
    IOperadorDAO personDAO = context.getBean(OperadorDAOImpl.class);
    /*
    personDAO.guardarOperador(o);
    context.close();
            
    Operador o = new Operador();
    o.setNombre("Camilo");
    o.setNombreUsuario("jdsj");
    o.setContrasena("sfso");
    o.setCine(c);
    o.setTipooperador(to);
    personDAO.guardarOperador(o);*/
    ISocioDAO socioDAO = context.getBean(ISocioDAO.class);
    /*
    Socio s = new Socio();
    s.setCedula("1040");
    s.setDireccion("calle 123");
    s.setNombre("Jaimito");
    s.setTelefono("83838");
    s.setEstado(true);
    socioDAO.guardarSocio(s);*/

    Socio s1 = socioDAO.obtenerSocioCedula("1040");
    System.out.println(s1.getNombre());

}

From source file:hotelregistration.HotelRegistration.java

/**
 * @param args the command line arguments
 *//*from  w ww .  j  a va 2 s .c o  m*/
public static void main(String[] args) {

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

    DBConnection dbCon = new DBConnection();
    dbCon.getConnetion();

    try {

        Statement st = dbCon.getConnetion().createStatement();
        ResultSet rs = st.executeQuery("SELECT NAME, ADDRESS FROM HOTEL");
        Hotel hotel = (Hotel) context.getBean("hotel");
        while (rs.next()) {
            hotel.setName(rs.getString("name"));
            hotel.setAddress(rs.getString("address"));
            System.out.println("1. Nombre: " + hotel.getName() + ", Direccion: " + hotel.getAddress());
        }

        HotelDao hotelDao = (HotelDao) context.getBean("hotelDao");
        Hotel hotel1 = hotelDao.findHotel("Moon");

        Hotel hotel2 = new Hotel();
        hotel2.setName("Jupiter");
        hotel2.setAddress("Jupiter");
        hotelDao.insertHotel(hotel2);

        System.out.println("2. Nombre: " + hotel1.getName() + ", Direccion: " + hotel1.getAddress());

    } catch (SQLException ex) {
        Logger.getLogger(HotelRegistration.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.github.liyp.dubbo.provider.Provider.java

public static void main(String[] args) throws Exception {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
            new String[] { "com/github/liyp/dubbo/provider/provider.xml" });
    context.start();//from  w  w  w. java2s. co  m
    System.out.println("dubbo provider running...");
    System.in.read();
}