类 ClassRelativeResourceLoader
- java.lang.Object
- org.springframework.core.io.DefaultResourceLoader
- org.springframework.core.io.ClassRelativeResourceLoader
- 所有已实现的接口:
ResourceLoader
public class ClassRelativeResourceLoader extends DefaultResourceLoader
ResourceLoader
implementation that interprets plain resource paths as relative to a givenjava.lang.Class
.- 从以下版本开始:
- 3.0
- 作者:
- Juergen Hoeller
- 另请参阅:
Class.getResource(String)
,ClassPathResource(String, Class)
嵌套类概要
从类继承的嵌套类/接口 org.springframework.core.io.DefaultResourceLoader
DefaultResourceLoader.ClassPathContextResource
字段概要
从接口继承的字段 org.springframework.core.io.ResourceLoader
CLASSPATH_URL_PREFIX
构造器概要
构造器 构造器 说明 ClassRelativeResourceLoader(Class<?> clazz)
Create a new ClassRelativeResourceLoader for the given class.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected Resource
getResourceByPath(String path)
Return a Resource handle for the resource at the given path.从类继承的方法 org.springframework.core.io.DefaultResourceLoader
addProtocolResolver, getClassLoader, getProtocolResolvers, getResource, setClassLoader
构造器详细资料
ClassRelativeResourceLoader
public ClassRelativeResourceLoader(Class<?> clazz)
Create a new ClassRelativeResourceLoader for the given class.- 参数:
clazz
- the class to load resources through
方法详细资料
getResourceByPath
protected Resource getResourceByPath(String path)
从类复制的说明:DefaultResourceLoader
Return a Resource handle for the resource at the given path.The default implementation supports class path locations. This should be appropriate for standalone implementations but can be overridden, e.g. for implementations targeted at a Servlet container.
- 覆盖:
getResourceByPath
在类中DefaultResourceLoader
- 参数:
path
- the path to the resource- 返回:
- the corresponding Resource handle
- 另请参阅:
ClassPathResource
,FileSystemXmlApplicationContext.getResourceByPath(java.lang.String)
,AbstractRefreshableWebApplicationContext.getResourceByPath(java.lang.String)