接口 PatternResourceLoader
- 所有超级接口:
ResourceLoader
- 所有已知实现类:
PathMatchingPatternResourceLoader
Resource objects.
This is an extension to the ResourceLoader
interface. A passed-in ResourceLoader (for example, an
cn.taketoday.context.ApplicationContext passed in via
cn.taketoday.context.ResourceLoaderAware when running in a context)
can be checked whether it implements this extended interface too.
PathMatchingPatternResourceLoader is a standalone implementation
that is usable outside an ApplicationContext.
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 defines a "classpath*:" resource
prefix for all matching resources from the module path and the class path. Note
that the resource location may also contain placeholders — for example
"/beans-*.xml". JAR files or different directories in the module path
or class path can contain multiple files of the same name.
- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller, Sam Brannen, TODAY 2021/10/7 17:26
- 另请参阅:
-
ResourceResourceLoadercn.taketoday.context.ApplicationContextcn.taketoday.context.ResourceLoaderAware
-
字段概要
字段修饰符和类型字段说明static final StringPseudo URL prefix for all matching resources from the class path:"classpath*:".从接口继承的字段 cn.taketoday.core.io.ResourceLoader
CLASSPATH_URL_PREFIX -
方法概要
修饰符和类型方法说明static PatternResourceLoaderfromResourceLoader(ResourceLoader resourceLoader) Return a defaultPatternResourceLoaderfor the givenResourceLoader.getResources(String locationPattern) Resolve the given location pattern intoResourceobjects.default Resource[]getResourcesArray(String locationPattern) Resolve the given location pattern intoResourceobjects.static booleanReturn whether the given resource location is a URL: either a special "classpath" or "classpath*" pseudo URL or a standard URL.voidscan(String locationPattern, ResourceConsumer consumer) Scan the given location pattern intoResourceobjects.从接口继承的方法 cn.taketoday.core.io.ResourceLoader
getClassLoader, getResource
-
字段详细资料
-
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 path — for example, to locate all "beans.xml" files in the root of all deployed JAR files you can use the location pattern"classpath*:/beans.xml".As of 4.0, the semantics for the
"classpath*:"prefix have been expanded to include the module path as well as the class path.
-
-
方法详细资料
-
getResources
Resolve the given location pattern intoResourceobjects.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- 返回:
- a mutable Set of the corresponding
Resourceinstances - 抛出:
IOException- in case of I/O errors
-
scan
Scan the given location pattern intoResourceobjects.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- 抛出:
IOException- in case of I/O errors
-
getResourcesArray
Resolve the given location pattern intoResourceobjects.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
Resourceobjects - 抛出:
IOException- in case of I/O errors
-
isUrl
Return whether the given resource location is a URL: either a special "classpath" or "classpath*" pseudo URL or a standard URL.- 参数:
resourceLocation- the location String to check- 返回:
- whether the location qualifies as a URL
- 另请参阅:
-
fromResourceLoader
Return a defaultPatternResourceLoaderfor the givenResourceLoader.This might be the
ResourceLoaderitself, if it implements theResourcePatternResolverextension, or a defaultPathMatchingPatternResourceLoaderbuilt on the givenResourceLoader.- 参数:
resourceLoader- the ResourceLoader to build a pattern resolver for (may benullto indicate a default ResourceLoader)- 返回:
- the ResourcePatternResolver
- 另请参阅:
-