<pre name="code" class="java">/**
*读取properties属性文件
* @throws IOException
*/
@Test
public void testReadProperties() throws IOException{
//创建 Properties
Properties prop = new Properties();
//获得输入流
InputStream in =
getClass().getClassLoader().getResourceAsStream("resources/jdbc.properties");
//Reads a property list (key and element pairs) from the input byte stream.
prop.load(in);
//Searches for the property with the specified key in this property list.
String user = prop.getProperty("user");
System.out.println(user);
}