public class ClassPathResource extends UrlResource
name, url
Constructor and Description |
---|
ClassPathResource(String path)
构造
|
ClassPathResource(String path,
Class<?> clazz)
构造
|
ClassPathResource(String path,
ClassLoader classLoader)
构造
|
ClassPathResource(String pathBaseClassLoader,
ClassLoader classLoader,
Class<?> clazz)
构造
|
Modifier and Type | Method and Description |
---|---|
String |
getAbsolutePath()
获得绝对路径Path
对于不存在的资源,返回拼接后的绝对路径 |
ClassLoader |
getClassLoader()
获得
ClassLoader |
String |
getPath()
获得Path
|
String |
toString()
返回路径
|
getFile, getName, getStream, getUrl, isModified, size
public ClassPathResource(String path)
path
- 相对于ClassPath的路径public ClassPathResource(String path, ClassLoader classLoader)
path
- 相对于ClassPath的路径classLoader
- ClassLoader
public ClassPathResource(String path, Class<?> clazz)
path
- 相对于给定Class的路径clazz
- Class
用于定位路径public ClassPathResource(String pathBaseClassLoader, ClassLoader classLoader, Class<?> clazz)
pathBaseClassLoader
- 相对路径classLoader
- ClassLoader
clazz
- Class
用于定位路径public final String getPath()
public final String getAbsolutePath()
public final ClassLoader getClassLoader()
ClassLoader
ClassLoader
public String toString()
UrlResource
toString
in class UrlResource
Copyright © 2024. All rights reserved.