Further clarify the semantics of ClassPathResource.getPath()
See gh-29094
This commit is contained in:
@@ -120,18 +120,21 @@ public class ClassPathResource extends AbstractFileResolvingResource {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the path for this resource.
|
* Return the path for this resource.
|
||||||
* <p>If this {@code ClassPathResource} was created using
|
* <p>If this resource was created using
|
||||||
* {@link ClassPathResource#ClassPathResource(String) ClassPathResource(String)} or
|
* {@link ClassPathResource#ClassPathResource(String) ClassPathResource(String)},
|
||||||
* {@link ClassPathResource#ClassPathResource(String, ClassLoader)
|
* {@link ClassPathResource#ClassPathResource(String, ClassLoader)
|
||||||
* ClassPathResource(String, ClassLoader)}, the returned path is a
|
* ClassPathResource(String, ClassLoader)}, or
|
||||||
* {@linkplain StringUtils#cleanPath(String) cleaned} version of the
|
* {@link ClassPathResource#ClassPathResource(String, Class)
|
||||||
|
* ClassPathResource(String, Class)} with an absolute path, the returned path
|
||||||
|
* is a {@linkplain StringUtils#cleanPath(String) cleaned} version of the
|
||||||
* <em>absolute path</em> supplied to the constructor.
|
* <em>absolute path</em> supplied to the constructor.
|
||||||
* <p>If this {@code ClassPathResource} was created using
|
* <p>If this resource was created using
|
||||||
* {@link ClassPathResource#ClassPathResource(String, Class)}, the
|
* {@link ClassPathResource#ClassPathResource(String, Class)
|
||||||
* returned path is a {@linkplain StringUtils#cleanPath(String) cleaned}
|
* ClassPathResource(String, Class)} with a relative path, the returned path
|
||||||
* version of the <em>relative path</em> supplied to the constructor.
|
* is a {@linkplain StringUtils#cleanPath(String) cleaned} version of the
|
||||||
* <p>If you need the <em>absolute path</em>, use {@link #getAbsolutePath()}
|
* <em>relative path</em> supplied to the constructor.
|
||||||
* instead.
|
* <p>If you consistently need the <em>absolute path</em>, use
|
||||||
|
* {@link #getAbsolutePath()} instead.
|
||||||
* @see #getAbsolutePath()
|
* @see #getAbsolutePath()
|
||||||
*/
|
*/
|
||||||
public final String getPath() {
|
public final String getPath() {
|
||||||
|
|||||||
Reference in New Issue
Block a user