ConfigPropertiesUtils { public static Properties replacePlaceholders(Properties props, Map<String, String> placeholderValues) { return replacePlaceholders(props, placeholderValues, false); } private  ConfigPropertiesUtils(); static Properties replacePlaceholders(Properties props,
                                                 Map<String, String> placeholderValues); static Properties replacePlaceholders(Properties props,
                                                 Map<String, String> placeholderValues, boolean ignoreAbsent); static String prettyString(Properties props); static String getStringProperty(Properties props, String key); static String getStringProperty(Properties props, String key, boolean required); static Integer getIntProperty(Properties props, String key, boolean required); static Integer getIntProperty(Properties props, String key); static File getFileProperty(Properties props, String key, boolean required);  }
@Test public void test1() { Properties props = new Properties(); props.setProperty("year", "2013"); props.setProperty("outputDir", "./${baseDir}/output"); props.setProperty("inputDir", "${baseDir}/input"); props.setProperty("configDir", "${baseDir}"); Map<String, String> phValues = Maps.newHashMap(); phValues.put("baseDir", "current"); ConfigPropertiesUtils.replacePlaceholders(props, phValues, false); assertEquals("2013", props.getProperty("year")); assertEquals("./current/output", props.getProperty("outputDir")); assertEquals("current/input", props.getProperty("inputDir")); assertEquals("current", props.getProperty("configDir")); }