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.golenok.lab_1_b.presentation.Main.java

/**
 * @param args the command line arguments
 *//*from www .j  a  v  a 2  s.com*/
public static void main(String[] args) {

    ApplicationContext context = new ClassPathXmlApplicationContext("application_context.xml");
    ApplicationService appServices = (ApplicationService) context.getBean("applicationServices");

    appServices.delEntitiesStartNameWithK();
    appServices.delEntitiesWhereIdNoFibo();
}

From source file:lydichris.smashbracket.Application.java

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "Beans.xml" });
    SpringApplication.run(Application.class, args);
}

From source file:com.softserveinc.internetbanking.testit.JDBCtemplateUser.java

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");

    UserJDBCTemplate userJDBCTemplate = (UserJDBCTemplate) context.getBean("userJDBCTemplate");

    System.out.println("----Listing Record with ID = 1 -----");
    User user = userJDBCTemplate.findUserByName("lex");
    String role = userJDBCTemplate.findUserRole(user.getId());
    System.out.println(role);//from  ww w  . j ava  2 s .c o m
}

From source file:com.swcguild.dvdlibraryv3.App.java

public static void main(String[] args) throws ParseException, FileNotFoundException, IOException {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");

    DVDLibraryController ct = ctx.getBean("dvdLibraryController", DVDLibraryController.class);
    //        DVDLibraryController start = new DVDLibraryController();
    //        start.run();
    ct.run();//from   ww  w.j av a 2s . c  om
}

From source file:com.dresen.dresen.Test.TestService.java

public static void main(String[] args) {
    System.out.println("Hello World!");

    ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:Spring-Config.xml");
    IDepartementService iDepartementService = ctx.getBean("IDepartementService", IDepartementService.class);
    Departement dep = new Departement("logone");
    Departement dep1;/*from w ww.ja  va 2 s.  c o m*/
    dep1 = iDepartementService.createDepartement(dep);
    System.out.println(dep1);
}

From source file:com.softserveinc.internetbanking.testit.JDBCtemplateMoneyTransaction.java

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");

    MoneyTransactionJDBCTemplate moneyTransactionJDBCTemplate = (MoneyTransactionJDBCTemplate) context
            .getBean("moneyTransactionJDBCTemplate");

    System.out.println("------Records Creation--------");
    BigDecimal number = new BigDecimal("200.00");
    moneyTransactionJDBCTemplate.createTransaction(1, 3, number);
    moneyTransactionJDBCTemplate.createTransaction(1, 3, number);

}

From source file:pl.altkom.spring.sample.Main.java

public static void main(String[] args) {

    System.out.println("!!!!!");

    AbstractRefreshableConfigApplicationContext ctx = new ClassPathXmlApplicationContext("spring-context.xml");

    ctx.registerShutdownHook();/*from w  ww  . j  av a  2 s  .c om*/

    NewsletterService newsletterService = ctx.getBean("newsletterServiceImpl", NewsletterService.class);
    newsletterService.send("tre", "temat");

    //ctx.close();

}

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

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

    ApplicationContext ctxFactory = new ClassPathXmlApplicationContext("applicationContext.xml");
    FlooringMasteryController flooringMasteryController = ctxFactory.getBean("controllerBean",
            FlooringMasteryController.class);

    flooringMasteryController.run();//w  ww  . j  ava 2 s .co m
}

From source file:com.searchengine.test.MainApp.java

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("com/searchengine/test/Beans.xml");

    DocumentJDBCTemplate documentJDBCTemplate = (DocumentJDBCTemplate) context.getBean("documentJDBCTemplate");

    System.out.println("------Records Creation--------");
    documentJDBCTemplate.create("ATITLE", "ANID");
    documentJDBCTemplate.create("ATITLE2", "ANID2");
    documentJDBCTemplate.create("ATITLE3", "ANID3");

    System.out.println("------Listing Multiple Records--------");
    List<Document> students = documentJDBCTemplate.listDocuments();
    for (Document record : students) {
        System.out.print("ID : " + record.getId());
        System.out.print(", Title : " + record.getTitle());
    }//from   w  w  w.j  a v a2 s.  c o  m

    System.out.println("----Updating Record with ID = 2 -----");
    documentJDBCTemplate.update("ANID2", "TITLEEE");

    System.out.println("----Listing Record with ID = 2 -----");
    Document student = documentJDBCTemplate.getDocument("ANID2");
    System.out.print("ID : " + student.getId());
    System.out.print(", Name : " + student.getTitle());

    documentJDBCTemplate.delete("ANID");
    documentJDBCTemplate.delete("ANID2");
    documentJDBCTemplate.delete("ANID3");

}

From source file:com.spring.tutorial.configuration.beansconfig.hybrid.App.java

public static void main(String[] args) {
    ApplicationContext ctx = new ClassPathXmlApplicationContext(
            "com/spring/tutorial/configuration/beansconfig/hybrid/applicationContext.xml");
    Foo foo = ctx.getBean(Foo.class);
    Bar bar = ctx.getBean(Bar.class);
    ((ClassPathXmlApplicationContext) ctx).close();
}