@@ -100,9 +100,13 @@ public ClassPathResource(String path, @Nullable ClassLoader classLoader) {
100
100
* the class path via a leading slash.
101
101
* <p>If the supplied {@code Class} is {@code null}, the default class
102
102
* loader will be used for loading the resource.
103
+ * <p>This is also useful for resource access within the module system,
104
+ * loading a resource from the containing module of a given {@code Class}.
105
+ * See {@link ModuleResource} and its javadoc.
103
106
* @param path relative or absolute path within the class path
104
107
* @param clazz the class to load resources with
105
108
* @see ClassUtils#getDefaultClassLoader()
109
+ * @see ModuleResource
106
110
*/
107
111
public ClassPathResource (String path , @ Nullable Class <?> clazz ) {
108
112
Assert .notNull (path , "Path must not be null" );
@@ -257,7 +261,7 @@ public String getFilename() {
257
261
*/
258
262
@ Override
259
263
public String getDescription () {
260
- return "class path resource [" + this .absolutePath + ']' ;
264
+ return "class path resource [" + this .absolutePath + "]" ;
261
265
}
262
266
263
267
@@ -272,7 +276,7 @@ public boolean equals(@Nullable Object obj) {
272
276
if (this == obj ) {
273
277
return true ;
274
278
}
275
- return (( obj instanceof ClassPathResource that ) &&
279
+ return (obj instanceof ClassPathResource that &&
276
280
this .absolutePath .equals (that .absolutePath ) &&
277
281
ObjectUtils .nullSafeEquals (getClassLoader (), that .getClassLoader ()));
278
282
}
0 commit comments