Interface ResourceResolver
- All Known Subinterfaces:
ResourceCapableCacheDataImporterExporter.CacheResourceResolver
,ResourceCapableCacheDataImporterExporter.ExportResourceResolver
,ResourceCapableCacheDataImporterExporter.ImportResourceResolver
- All Known Implementing Classes:
ResourceCapableCacheDataImporterExporter.AbstractCacheResourceResolver
,ResourceCapableCacheDataImporterExporter.AbstractExportResourceResolver
,ResourceCapableCacheDataImporterExporter.AbstractImportResourceResolver
,ResourceCapableCacheDataImporterExporter.ClassPathImportResourceResolver
,ResourceCapableCacheDataImporterExporter.FileSystemExportResourceResolver
,ResourceLoaderResourceResolver
,SingleResourceResolver
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Interface defining a contract encapsulating an algorithm/strategy for resolving
Resources
.- Since:
- 1.3.1.
- See Also:
-
FunctionalInterface
Resource
-
Method Summary
Modifier and TypeMethodDescriptiondefault Optional<ClassLoader>
default org.springframework.core.io.Resource
Returns a non-null, existingResource
handle resolved from the given, non-nulllocation
(e.g.Optional<org.springframework.core.io.Resource>
Tries to resolve aResource
handle from the given, non-nulllocation
(e.g.
-
Method Details
-
getClassLoader
Gets theClassLoader
used by thisResourceResolver
to resolve classpathResources
. By default, this method will return aClassLoader
determined byClassUtils.getDefaultClassLoader()
, which first tries to return theThread.getContextClassLoader()
, thenClass.getClassLoader()
, and finally,ClassLoader.getSystemClassLoader()
.- Returns:
- an
Optional
ClassLoader
used to resolve classpathResources
. - See Also:
-
ClassUtils.getDefaultClassLoader()
ClassLoader
Optional
-
resolve
-
require
Returns a non-null, existingResource
handle resolved from the given, non-nulllocation
(e.g.filesystem path
).- Parameters:
location
-location
identifying theResource
to resolve; must not be null.- Returns:
- a non-null, existing
Resource
handle for the resolvedlocation
. - Throws:
ResourceNotFoundException
- if aResource
cannot be resolved from the givenlocation
. AResource
is unresolvable if the givenlocation
does not exist (physically); seeResource.exists()
.- See Also:
-
Resource
resolve(String)
-