package com.happy.util;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class Read {
/**
* 读取properties文件,并得到其值。
* @param fileName
* @param key
*/
public String readProperties(String key) {
InputStream inputStream = this.getClass().getClassLoader()
.getResourceAsStream("jdbc.properties");
Properties p = new Properties();
try {
p.load(inputStream);
} catch (IOException e1) {
e1.printStackTrace();
}
return p.getProperty(key);
}
public static void main(String[] args) {
Read read = new Read();
System.out.println(read.readProperties("name"));
}
}