Properties properties=new Properties(); //读取properties文件
// InputStream inputStream=new FileInputStream(new File("src/property.properties")); 文件在src目录下
InputStream inputStream=JdbcUtil.class.getClassLoader().getResourceAsStream("property.properties"); //使用classLoader加载classpath路径
properties.load(inputStream);
String str=(String) properties.get("JdbcUtil");
Class c=Class.forName(str);
读取properties文件和类加载器
最新推荐文章于 2022-08-06 16:49:46 发布