package com.ceair.common.util;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class PropertiesUtil {
/**
* 根据键值(KEY)获取对应的值
*
* @param 键值
* @return
*/
public static String getValue(String key) {
return getValue("ibeconfig.properties", key);
}
/**
* 根据键值(KEY)获取对应的值
*
* @param proFileName
* 配置文件名称
* @param key
* 键值
* @return
*/
public static String getValue(String proFileName, String key) {
try {
Properties pro = new Properties();
InputStream in = PropertiesUtil.class.getClassLoader()
.getResourceAsStream(proFileName);
pro.load(in);
String value = pro.getProperty(key);
in.close();
return value;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
public static void main(String[] args) {
System.out.println(getValue("b2tUrl.properties","eholiday.b2c.b2tBooking.url"));
}
}