Properties properties = new Properties();
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("datasource.properties");
try {
properties.load(inputStream);
} catch (IOException e) {
e.printStackTrace();
}
System.out.print(properties.getProperty("initialContextfactory"));
System.out.print(properties.getProperty("providerURL"));
System.out.print(properties.getProperty("dataSource"));
getClass().getClassLoader().//默认的是src文件夹下
getClass()//表示当前包中的文件