加载配置文件

来源:互联网 发布:手机温度计软件中文版 编辑:程序博客网 时间:2024/05/03 00:38
package com.epay.utils;import java.util.Properties;/** * 读取配置文件 * */public class ConfigInfo {/** 静态缓存只加载一次 */private static Properties cache = new Properties();static{try {cache.load(ConfigInfo.class.getClassLoader().getResourceAsStream("merchantInfo.properties"));} catch (Exception e) {e.printStackTrace();}}/** * 获取指定key的值 * @param key * @return */public static String getValue(String key){return cache.getProperty(key);}}

加载配置文件:
0 0
原创粉丝点击