java readProperties

Posted Googler

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java readProperties相关的知识,希望对你有一定的参考价值。

@Deprecated
public static Map<String, String> readProperties(String propertiesFile) {
    Properties prop = new Properties();
    try {
        prop.load(new InputStreamReader(
                App.class.getClassLoader().getResourceAsStream(propertiesFile + ".properties"), UTF8));
    } catch (Exception ex) {
        throw SystemException.wrap(ex);
    }

    Map<String, String> map = new HashMap<>();
    for (String key : prop.stringPropertyNames()) {
        map.put(key, isNull(prop.getProperty(key), ""));
    }
    return map;
}

 

以上是关于java readProperties的主要内容,如果未能解决你的问题,请参考以下文章