public static String getValue(String key) {
EncodedResource resource = new EncodedResource(new ClassPathResource("orderFromOut.properties"), "UTF-8");
// ClassPathResource resource = new ClassPathResource("orderFromOut.properties");
Properties resviceprop = null;
//装载配置文件
try {
resviceprop = PropertiesLoaderUtils.loadProperties(resource);
} catch (IOException e) {
e.printStackTrace();
}
//返回获取的值
return resviceprop.getProperty(key);
}
public static void main(String[] args) {
System.out.println(ApplicationOut.getValue("天津市"));
}
PropertiesLoaderUtils获取不到key是中文的值
最新推荐文章于 2023-07-20 13:21:51 发布