如题,用ClassLoader 获得的是
repositories:
/WEB-INF/classes/,
我想通过:
//获取配置文件信息的输入流。
ClassLoader classLoader = getClass().getClassLoader();
System.out.println(classLoader.toString());
InputStream is = classLoader.getResourceAsStream("jdbc.properties");
System.out.println(is);
获取配置文件,该如何改写代码。
如下是输出结果,以及工程目录结构。


jdbc.properties这种文件,Java里面有专门加载方式。
String configFil="database.propertise";
properties=new Properties();
InputStream inputStream=ConfigManager.class.getClassLoader().getResourceAsStream(configFil);
properties.load(inputStream);