Example usage for org.springframework.context.support FileSystemXmlApplicationContext FileSystemXmlApplicationContext

List of usage examples for org.springframework.context.support FileSystemXmlApplicationContext FileSystemXmlApplicationContext

Introduction

In this page you can find the example usage for org.springframework.context.support FileSystemXmlApplicationContext FileSystemXmlApplicationContext.

Prototype

public FileSystemXmlApplicationContext(String... configLocations) throws BeansException 

Source Link

Document

Create a new FileSystemXmlApplicationContext, loading the definitions from the given XML files and automatically refreshing the context.

Usage

From source file:com.freemarker.mail.GMail.java

public void setMailsender() {
    this.mailsender = (JavaMailSenderImpl) new FileSystemXmlApplicationContext(
            "E:\\AMM_WEBLOGIC_BUILD\\FreeMarkerPOC\\src\\main\\webapp\\WEB-INF\\spring-mail.xml")
                    .getBean("mailsender");

}

From source file:org.jaffre.springframework.JaffreExporterTestCase.java

public void test() throws Exception {
    final File l_fileAppContext;
    final FileSystemXmlApplicationContext l_appCtx;

    l_fileAppContext = PackageFile.get("test-resources/appcontext01.xml");
    assertTrue(l_fileAppContext.isFile());

    l_appCtx = new FileSystemXmlApplicationContext(l_fileAppContext.getPath());

    l_appCtx.start();//from  w w w  .j  av a 2  s . c  o  m

    assertEquals(6, l_appCtx.getBeanDefinitionCount());
    assertNotNull(l_appCtx.getBean("jaffreClient"));
    assertNotNull(l_appCtx.getBean("jaffreServer"));
    assertNotNull(l_appCtx.getBean("jaffreConnector"));
    assertNotNull(l_appCtx.getBean("jaffreExporter"));
    assertNotNull(l_appCtx.getBean("throwException"));
    assertNotNull(l_appCtx.getBean("greeting"));

    l_appCtx.stop();
    l_appCtx.close();
}

From source file:org.apache.ftpserver.config.spring.PropertyPlaceholderTest.java

public void test() throws Throwable {
    System.setProperty("port2", "3333");

    FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext(
            "src/test/resources/spring-config/config-property-placeholder.xml");

    DefaultFtpServer server = (DefaultFtpServer) ctx.getBean("server");

    assertEquals(2222, server.getListener("listener0").getPort());
    assertEquals(3333, server.getListener("listener1").getPort());
}

From source file:org.apache.smscserver.test.spring.PropertyPlaceholderTest.java

public void test() throws Throwable {
    System.setProperty("port2", "3333");

    FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext(
            "src/test/resources/spring-config/config-property-placeholder.xml");

    DefaultSmscServer server = (DefaultSmscServer) ctx.getBean("server");

    Assert.assertEquals(2222, server.getServerContext().getListener("listener0").getPort());
    Assert.assertEquals(3333, server.getServerContext().getListener("listener1").getPort());
}

From source file:com.jamesashepherd.sshproxyj.core.Start.java

@Override
public void startup() throws StartException {
    logger.info("sshproxyj starting");
    Security.addProvider(new BouncyCastleProvider());
    context = new FileSystemXmlApplicationContext(getSpringConfigURL());
}

From source file:com.pontecultural.flashcards.FetchCardsByDeckIdTest.java

@Before
public void setupContext() {
    // project home is assumed - '/home/jkern/workspace/JavaSpring/'
    dbCtx = new FileSystemXmlApplicationContext(
            "src/main/webapp/WEB-INF/spring/appServlet/flashcards-persistence-test.xml");
    jdbcFlashcardsDao = (JdbcFlashcardsDao) dbCtx.getBean("jdbcFlashcardsDaoTest");
    jdbcFlashcardsDao.deleteAll();// w w w.  j ava 2s .c  o  m
    // now populate the database 
    ods = new ReadSpreadsheet();
    ods.setJdbcFlashcardsDao(jdbcFlashcardsDao);
    ods.setOdsFile("/home/jkern/workspace/JavaSpring/test/data/FlashCardsTest.ods");
    ods.run();
}

From source file:com.china317.gmmp.gmmp_report_analysis.cache.LineDenoterCache.java

public void init(String yyyyMMdd) {
    xplMap = new HashMap<String, LineDenoter>();
    numMap = new HashMap<String, LineDenoterCount>();

    ApplicationContext context = new FileSystemXmlApplicationContext(
            "//home/gmmp/repAnalysis/bin/applicationcontext.xml");
    LineDenoterDao dao = (LineDenoterDao) context.getBean("lineDenoterDao");
    List<LineDenoter> list = dao.getLineDenoterByDate(yyyyMMdd);
    for (LineDenoter denoter : list) {
        xplMap.put(denoter.getLicenseCard(), denoter);
        LineDenoterCount c = new LineDenoterCount();
        c.setLabelNumber(denoter.getLabelNumber());
        numMap.put(denoter.getLabelNumber(), c);
    }/*from w w w .  ja va 2 s . co m*/
    HASUPDATE = true;
}

From source file:org.craftercms.cstudio.publishing.PublishingReceiverMainDeamon.java

private Server initializeContext() throws IOException {
    System.setProperty("org.terracotta.quartz.skipUpdateCheck", "true");
    context = new FileSystemXmlApplicationContext("classpath:spring/application-context.xml");
    return (Server) context.getBean("Server");
}

From source file:com.pontecultural.flashcards.ReadInSpreadSheetTest.java

@Before
public void setupContext() {
    // project home is assumed - '/home/jkern/workspace/JavaSpring/'
    dbCtx = new FileSystemXmlApplicationContext(
            "src/main/webapp/WEB-INF/spring/appServlet/flashcards-persistence-test.xml");
    jdbcFlashcardsDao = (JdbcFlashcardsDao) dbCtx.getBean("jdbcFlashcardsDaoTest");
    jdbcFlashcardsDao.deleteAll();/*w  w w.j  a  v a  2s .  c om*/

    // now populate the database 
    ods = new ReadSpreadsheet();
    ods.setJdbcFlashcardsDao(jdbcFlashcardsDao);
    ods.setOdsFile("/home/jkern/workspace/JavaSpring/test/data/FlashCardsTest.ods");
    ods.run();
}

From source file:cn.easy.plugin.spring.SpringPlugin.java

public boolean start() {
    if (ctx != null)
        IocInterceptor.ctx = ctx;/*from   ww w. ja  v a  2  s .c om*/
    else if (configurations != null)
        IocInterceptor.ctx = new FileSystemXmlApplicationContext(configurations);
    else
        IocInterceptor.ctx = new FileSystemXmlApplicationContext(
                PathUtil.getWebRootPath() + "/WEB-INF/applicationContext.xml");
    return true;
}