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

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

Introduction

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

Prototype

@Override
    public <T> T getBean(String name, Class<T> requiredType) throws BeansException 

Source Link

Usage

From source file:org.springframework.data.hadoop.admin.util.HadoopWorkflowDescriptorUtilsTest.java

@Test
public void testReplacePropertyPlaceHolder() {
    String fileName = "src/test/resources/org/springframework/data/hadoop/admin/util/context.xml";
    String properFilename = "src/test/resources/org/springframework/data/hadoop/admin/util/hadoop.properties";
    File f = new File(fileName);
    File propertiesFile = new File(properFilename);
    logger.debug("path:" + f.getParentFile().getAbsolutePath());
    if (f != null) {
        try {/*from  ww w.ja v  a2s .  c  o  m*/
            util.replacePropertyPlaceHolder(f, propertiesFile);
        } catch (SpringHadoopAdminWorkflowException e) {
            fail("exception was thrown when replacing proeprty place holder." + e.getMessage());
        }
    }
    FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext(fileName);
    SimpleBean bean = ctx.getBean("simpleBean", SimpleBean.class);
    Assert.assertEquals(
            "file://src/test/resources/org/springframework/data/hadoop/admin/util/hadoop-examples-1.0.0.jar",
            bean.getPath());
}