国产探花免费观看_亚洲丰满少妇自慰呻吟_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;}}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 商水县| 平利县| 宣汉县| 三台县| 重庆市| 西华县| 福贡县| 梅河口市| 定陶县| 登封市| 成安县| 安塞县| 新郑市| 宜君县| 瑞金市| 晋州市| 灵川县| 苗栗市| 南通市| 比如县| 女性| 伊金霍洛旗| 惠州市| 景谷| 汨罗市| 龙山县| 雷州市| 孟州市| 剑阁县| 辽阳市| 庄河市| 思茅市| 泰顺县| 天气| 五华县| 河津市| 南漳县| 剑阁县| 霞浦县| 新干县| 安新县|