接口 ResourcePatternResolver
- 所有超级接口:
ResourceLoader
- 所有已知子接口:
ApplicationContext
,ConfigurableApplicationContext
,ConfigurablePortletApplicationContext
,ConfigurableWebApplicationContext
,WebApplicationContext
- 所有已知实现类:
AbstractApplicationContext
,AbstractRefreshableApplicationContext
,AbstractRefreshableConfigApplicationContext
,AbstractRefreshablePortletApplicationContext
,AbstractRefreshableWebApplicationContext
,AbstractXmlApplicationContext
,AnnotationConfigApplicationContext
,AnnotationConfigWebApplicationContext
,ClassPathXmlApplicationContext
,FileSystemXmlApplicationContext
,GenericApplicationContext
,GenericGroovyApplicationContext
,GenericWebApplicationContext
,GenericXmlApplicationContext
,GroovyWebApplicationContext
,PathMatchingResourcePatternResolver
,PortletContextResourcePatternResolver
,ResourceAdapterApplicationContext
,ServletContextResourcePatternResolver
,StaticApplicationContext
,StaticPortletApplicationContext
,StaticWebApplicationContext
,XmlPortletApplicationContext
,XmlWebApplicationContext
public interface ResourcePatternResolver extends ResourceLoader
Strategy interface for resolving a location pattern (for example, an Ant-style path pattern) into Resource objects.This is an extension to the
ResourceLoader
interface. A passed-in ResourceLoader (for example, anApplicationContext
passed in viaResourceLoaderAware
when running in a context) can be checked whether it implements this extended interface too.PathMatchingResourcePatternResolver
is a standalone implementation that is usable outside an ApplicationContext, also used byResourceArrayPropertyEditor
for populating Resource array bean properties.Can be used with any sort of location pattern (e.g. "/WEB-INF/*-context.xml"): Input patterns have to match the strategy implementation. This interface just specifies the conversion method rather than a specific pattern format.
This interface also suggests a new resource prefix "classpath*:" for all matching resources from the class path. Note that the resource location is expected to be a path without placeholders in this case (e.g. "/beans.xml"); JAR files or classes directories can contain multiple files of the same name.
- 从以下版本开始:
- 1.0.2
- 作者:
- Juergen Hoeller
- 另请参阅:
Resource
,ResourceLoader
,ApplicationContext
,ResourceLoaderAware
字段概要
字段 修饰符和类型 字段 说明 static String
CLASSPATH_ALL_URL_PREFIX
Pseudo URL prefix for all matching resources from the class path: "classpath*:" This differs from ResourceLoader's classpath URL prefix in that it retrieves all matching resources for a given name (e.g.从接口继承的字段 org.springframework.core.io.ResourceLoader
CLASSPATH_URL_PREFIX
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 Resource[]
getResources(String locationPattern)
Resolve the given location pattern into Resource objects.从接口继承的方法 org.springframework.core.io.ResourceLoader
getClassLoader, getResource
字段详细资料
CLASSPATH_ALL_URL_PREFIX
static final String CLASSPATH_ALL_URL_PREFIX
Pseudo URL prefix for all matching resources from the class path: "classpath*:" This differs from ResourceLoader's classpath URL prefix in that it retrieves all matching resources for a given name (e.g. "/beans.xml"), for example in the root of all deployed JAR files.
方法详细资料
getResources
Resource[] getResources(String locationPattern) throws IOException
Resolve the given location pattern into Resource objects.Overlapping resource entries that point to the same physical resource should be avoided, as far as possible. The result should have set semantics.
- 参数:
locationPattern
- the location pattern to resolve- 返回:
- the corresponding Resource objects
- 抛出:
IOException
- in case of I/O errors