spring property擴展
阿新 • • 發佈:2017-08-19
work lac com throw value spring .config redis tegra
復制代碼 package com.sf.integration.ident.redis; import java.io.IOException; import java.util.Properties; import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; public class SSSPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer { private static Properties props; @Overridepublic Properties mergeProperties() throws IOException { props = super.mergeProperties(); Property.init(props); return props; } } 復制代碼 復制代碼 package com.sf.integration.ident.redis; public class Property { private static java.util.Properties property; private Property() { }static void init(java.util.Properties props) { property = props; } public static String getProperty(String key) { return property.getProperty(key); } public static String getProperty(String key, String defaultValue) { return property.getProperty(key, defaultValue); } }
spring property擴展