import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.env.Environment;
public class NPropertyUtil /*extends PropertyPlaceholderConfigurer*/{
private static Log logger = LogFactory.getLog(NPropertyUtil.class);
private static Environment env;
public NPropertyUtil(Environment env) {
NPropertyUtil.env = env;
}
public static String getProperyValue(String key) {
String value = null;
if (StringUtils.isNotBlank(key)) {
value = env.getProperty(key);
if (StringUtils.isNotBlank(value)) {
try {
value = new String(value.getBytes("ISO-8859-1"), "UTF-8");
} catch (Exception e) {
logger.error("NPropertyUtil Exception", e);
}
}
}
return value;
}