package com.*.*.web.utils;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.springframework.core.io.support.PropertiesLoaderUtils;
public class CacheAgreementInfo {
@SuppressWarnings("unused")
public static Map<String, String> CacheAgreementInfo() throws Exception {
Map<String, String> agreementMap = new HashMap<String, String>();
Properties props = new Properties();
try {
props=PropertiesLoaderUtils.loadAllProperties("*.properties");
for(Object key:props.keySet()){
String valueIs = (String)props.get(key);
String value=new String(valueIs.getBytes("ISO8859-1"),"UTF-8");
agreementMap.put((String) key, value);
}
} catch (IOException e) {
throw new Exception("读取协议文件失败");
}
return agreementMap;
}
public static void main(String[] args) throws Exception {
CacheAgreementInfo();
}
}
JAVA项目读取配置文件【相对路径】
最新推荐文章于 2024-07-24 00:04:57 发布