List of usage examples for java.lang ClassLoader getSystemResources
public static Enumeration<URL> getSystemResources(String name) throws IOException
From source file:org.springframework.core.io.support.SpringFactoriesLoader.java
private static Map<String, List<String>> loadSpringFactories(@Nullable ClassLoader classLoader) { MultiValueMap<String, String> result = cache.get(classLoader); if (result != null) return result; try {/*from w w w . j a v a2 s . co m*/ Enumeration<URL> urls = (classLoader != null ? classLoader.getResources(FACTORIES_RESOURCE_LOCATION) : ClassLoader.getSystemResources(FACTORIES_RESOURCE_LOCATION)); result = new LinkedMultiValueMap<>(); while (urls.hasMoreElements()) { URL url = urls.nextElement(); UrlResource resource = new UrlResource(url); Properties properties = PropertiesLoaderUtils.loadProperties(resource); for (Map.Entry<?, ?> entry : properties.entrySet()) { List<String> factoryClassNames = Arrays .asList(StringUtils.commaDelimitedListToStringArray((String) entry.getValue())); result.addAll((String) entry.getKey(), factoryClassNames); } } cache.put(classLoader, result); return result; } catch (IOException ex) { throw new IllegalArgumentException( "Unable to load factories from location [" + FACTORIES_RESOURCE_LOCATION + "]", ex); } }
From source file:test.integ.be.agiv.security.CXFTest.java
@Test public void testCatalog() throws Exception { Enumeration<URL> resources = ClassLoader.getSystemResources("META-INF/jax-ws-catalog.xml"); while (resources.hasMoreElements()) { URL resourceUrl = resources.nextElement(); LOG.debug("resource: " + resourceUrl); }//from w ww. j a v a 2 s . co m }