java属性文件读取
方法一:
public static String getPropertriseValue(String key)
{
InputStream is = 类名.class.getResourceAsStream("/config/config.properties");
Properties p = new Properties();
String value ="";
try {
p.load(is);
value = p.getProperty(key);
is.close();
} catch (IOException e)
{
e.printStackTrace();
}
return value;
}
public class GetPropertries {
/**
* 读取配置文件,根据key值返回value
* @param String key 查询的key值
* @return String value 返回key值对应value
* */
public static String getPropertriseValue(String key){
InputStream is = GetPropertries.class.getResourceAsStream("/config/config.properties");
Properties p = new Properties();
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余2页未读,立即下载