1
1
/*
2
- * Copyright 2002-2015 the original author or authors.
2
+ * Copyright 2002-2016 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
156
156
* classpath:com/mycompany/**/service-context.xml
157
157
* </pre>
158
158
* is used to try to resolve it, the resolver will work off the (first) URL
159
- * returned by {@code getResource("com/mycompany");}. If this base package
160
- * node exists in multiple classloader locations, the actual end resource may
161
- * not be underneath. Therefore, preferably, use "{@code classpath*:}" with the same
159
+ * returned by {@code getResource("com/mycompany");}. If this base package node
160
+ * exists in multiple classloader locations, the actual end resource may not be
161
+ * underneath. Therefore, preferably, use "{@code classpath*:}" with the same
162
162
* Ant-style pattern in such a case, which will search <i>all</i> class path
163
163
* locations that contain the root package.
164
164
*
@@ -308,6 +308,9 @@ protected Resource[] findAllClassPathResources(String location) throws IOExcepti
308
308
path = path .substring (1 );
309
309
}
310
310
Set <Resource > result = doFindAllClassPathResources (path );
311
+ if (logger .isDebugEnabled ()) {
312
+ logger .debug ("Resolved classpath location [" + location + "] to resources " + result );
313
+ }
311
314
return result .toArray (new Resource [result .size ()]);
312
315
}
313
316
@@ -316,6 +319,7 @@ protected Resource[] findAllClassPathResources(String location) throws IOExcepti
316
319
* Called by {@link #findAllClassPathResources(String)}.
317
320
* @param path the absolute path within the classpath (never a leading slash)
318
321
* @return a mutable Set of matching Resource instances
322
+ * @since 4.1.1
319
323
*/
320
324
protected Set <Resource > doFindAllClassPathResources (String path ) throws IOException {
321
325
Set <Resource > result = new LinkedHashSet <Resource >(16 );
@@ -350,6 +354,7 @@ protected Resource convertClassLoaderURL(URL url) {
350
354
* given set of resources in the form of pointers to the root of the jar file content.
351
355
* @param classLoader the ClassLoader to search (including its ancestors)
352
356
* @param result the set of resources to add jar roots to
357
+ * @since 4.1.1
353
358
*/
354
359
protected void addAllClassLoaderJarRoots (ClassLoader classLoader , Set <Resource > result ) {
355
360
if (classLoader instanceof URLClassLoader ) {
@@ -381,6 +386,7 @@ protected void addAllClassLoaderJarRoots(ClassLoader classLoader, Set<Resource>
381
386
}
382
387
if (classLoader != null ) {
383
388
try {
389
+ // Hierarchy traversal...
384
390
addAllClassLoaderJarRoots (classLoader .getParent (), result );
385
391
}
386
392
catch (Exception ex ) {
0 commit comments