国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

讀取properties配置文件代碼

2019-11-08 02:33:24
字體:
來源:轉載
供稿:網友
public class ConfigUtils {PRivate static final Logger log = Logger.getLogger(ConfigUtils.class);private static final String DEPLOY_CONFIG_PROPERTIES = "deploy-config.properties";private static final String OperaTION_CONFIG_PROPERTIES = "operation-config.properties";private static final Map<String, String> map = new HashMap<String, String>();static {InputStream deployIn = ConfigUtils.class.getClassLoader().getResourceAsStream(ConfigUtils.DEPLOY_CONFIG_PROPERTIES);InputStream operationIn = ConfigUtils.class.getClassLoader().getResourceAsStream(ConfigUtils.OPERATION_CONFIG_PROPERTIES);Properties properties = new Properties();try {properties.load(deployIn);properties.load(operationIn);Set<Entry<Object, Object>> entrys = properties.entrySet();for (Entry<Object, Object> entry : entrys) {map.put(entry.getKey().toString(), entry.getValue().toString());}} catch (IOException e) {log.error("load upload.properties wrong");log.error(e.toString());} finally {try {deployIn.close();operationIn.close();} catch (IOException e) {log.error(e.toString());}}}/*** 依據key獲取對應的value* @param key* @return*/public static String getValue(String key) {String value = null;String keyValue = map.get(key);if (StringUtils.isNotBlank(keyValue)) {value = keyValue.trim();}return value;}}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 旺苍县| 昆山市| 镇安县| 东方市| 淮滨县| 娄烦县| 宣恩县| 土默特左旗| 赤峰市| 屏边| 福安市| 高唐县| 崇仁县| 塔河县| 淮安市| 根河市| 习水县| 福泉市| 若尔盖县| 肇庆市| 台中市| 友谊县| 玉林市| 宁化县| 县级市| 西吉县| 营口市| 昌邑市| 遂平县| 凤山县| 木兰县| 民乐县| 延安市| 九龙县| 岳阳县| 柳林县| 普宁市| 鲜城| 高阳县| 桦川县| 突泉县|