import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
/**
*
* @author <br>
* @date 2013年8月10日上午11:16:24<br>
*/
public class DabeiPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {
public DabeiPropertyPlaceholderConfigurer() {
PROPERTIES = new HashMap<String, String>();
}
/**
* 属性key,value
*/
private static Map<String, String> PROPERTIES;
/**
*
*/
protected void convertProperties(Properties props) {
Set<String> keys = props.stringPropertyNames();
for (String key : keys) {
String value = props.getProperty(key);
PROPERTIES.put(key, value);
}
super.convertProperties(props);
}
/**
*
* @param key
* @return<br>
* @date 2013年8月11日上午1:46:07<br>
* @author <br>
*/
public String getValue(String key) {
return PROPERTIES.get(key);
}
}
重写PropertyPlaceholderConfigurer
最新推荐文章于 2022-12-21 09:01:22 发布