public class ClassRelativeResourceLoader extends DefaultResourceLoader
ResourceLoader
implementation that interprets plain resource paths
as relative to a given java.lang.Class
.Class.getResource(String)
,
ClassPathResource.ClassPathResource(String, Class)
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.
|
getClassLoader, getResource, setClassLoader
public ClassRelativeResourceLoader(Class<?> clazz)
clazz
- the class to load resources throughprotected Resource getResourceByPath(String path)
DefaultResourceLoader
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 resourceClassPathResource
,
org.springframework.context.support.FileSystemXmlApplicationContext#getResourceByPath
,
org.springframework.web.context.support.XmlWebApplicationContext#getResourceByPath
Copyright © 2018 jretty-org. All rights reserved.