【java编程】加载Resources配置文件的方法
一、加载配置实现k-v
//FILTER_PROPERTY_NAME=META-INF/abc.properties private void loadFilterConfig(Properties filterProperties, ClassLoader classLoader) throws IOException { if (classLoader == null) { return; } for (Enumeration<URL> e = classLoader.getResources(FILTER_PROPERTY_NAME); e.hasMoreElements();) { URL url = e.nextElement(); Properties property = new Properties(); InputStream is = null; try { is = url.openStream(); property.load(is); } finally { if (is != null) { is.close(); } } filterProperties.putAll(property); } }