java常用工具类
读取property
private static Properties pro=new Properties();
static {
InputStream in = App.class.getClassLoader().getResourceAsStream("jdbc.properties");
try {
pro.load(in);
}catch (IOException e){
e.printStackTrace();
}
}
public static void main( String[] args ){
System.out.println(getProperty("username"));
}
public static String getProperty(String key){
return pro.getProperty(key);
}

浙公网安备 33010602011771号