Package org.springframework.boot.io
Class ApplicationResourceLoader
java.lang.Object
org.springframework.core.io.DefaultResourceLoader
org.springframework.boot.io.ApplicationResourceLoader
- All Implemented Interfaces:
ResourceLoader
Class can be used to obtain
ResourceLoaders
supporting
additional ProtocolResolvers
registered in
spring.factories
.
When not delegating to an existing resource loader, plain paths without a qualifier
will resolve to file system resources. This is different from
DefaultResourceLoader
, which resolves unqualified paths to classpath resources.
- Since:
- 3.3.0
- Author:
- Scott Frederick, Phillip Webb
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.core.io.DefaultResourceLoader
DefaultResourceLoader.ClassPathContextResource
-
Field Summary
Fields inherited from interface org.springframework.core.io.ResourceLoader
CLASSPATH_URL_PREFIX
-
Constructor Summary
ConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version.ApplicationResourceLoader
(ClassLoader classLoader) Deprecated, for removal: This API element is subject to removal in a future version.since 3.4.0 for removal in 3.6.0 in favor ofget(ClassLoader)
-
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceLoader
get()
static ResourceLoader
get
(ClassLoader classLoader) static ResourceLoader
get
(ClassLoader classLoader, SpringFactoriesLoader springFactoriesLoader) static ResourceLoader
get
(ResourceLoader resourceLoader) Return aResourceLoader
delegating to the given resource loader and supporting additionalProtocolResolvers
registered inspring.factories
.static ResourceLoader
get
(ResourceLoader resourceLoader, SpringFactoriesLoader springFactoriesLoader) Return aResourceLoader
delegating to the given resource loader and supporting additionalProtocolResolvers
registered inspring.factories
.protected Resource
getResourceByPath
(String path) Methods inherited from class org.springframework.core.io.DefaultResourceLoader
addProtocolResolver, clearResourceCaches, getClassLoader, getProtocolResolvers, getResource, getResourceCache, setClassLoader
-
Constructor Details
-
ApplicationResourceLoader
Deprecated, for removal: This API element is subject to removal in a future version.since 3.4.0 for removal in 3.6.0 in favor ofget()
Create a newApplicationResourceLoader
. -
ApplicationResourceLoader
@Deprecated(since="3.4.0", forRemoval=true) public ApplicationResourceLoader(ClassLoader classLoader) Deprecated, for removal: This API element is subject to removal in a future version.since 3.4.0 for removal in 3.6.0 in favor ofget(ClassLoader)
Create a newApplicationResourceLoader
.- Parameters:
classLoader
- theClassLoader
to load class path resources with, ornull
for using the thread context class loader at the time of actual resource access
-
-
Method Details
-
getResourceByPath
- Overrides:
getResourceByPath
in classDefaultResourceLoader
-
get
Return aResourceLoader
supporting additionalProtocolResolvers
registered inspring.factories
. The factories file will be resolved using the default class loader at the time this call is made. Resources will be resolved using the default class loader at the time they are resolved.- Returns:
- a
ResourceLoader
instance - Since:
- 3.4.0
-
get
Return aResourceLoader
supporting additionalProtocolResolvers
registered inspring.factories
. The factories files and resources will be resolved using the specified class loader.- Parameters:
classLoader
- the class loader to use ornull
to use the default class loader- Returns:
- a
ResourceLoader
instance - Since:
- 3.4.0
-
get
public static ResourceLoader get(ClassLoader classLoader, SpringFactoriesLoader springFactoriesLoader) - Parameters:
classLoader
- the class loader to use ornull
to use the default class loaderspringFactoriesLoader
- theSpringFactoriesLoader
used to loadProtocolResolvers
- Returns:
- a
ResourceLoader
instance - Since:
- 3.4.0
-
get
Return aResourceLoader
delegating to the given resource loader and supporting additionalProtocolResolvers
registered inspring.factories
. The factories file will be resolved using the default class loader at the time this call is made.- Parameters:
resourceLoader
- the delegate resource loader- Returns:
- a
ResourceLoader
instance - Since:
- 3.4.0
-
get
public static ResourceLoader get(ResourceLoader resourceLoader, SpringFactoriesLoader springFactoriesLoader) Return aResourceLoader
delegating to the given resource loader and supporting additionalProtocolResolvers
registered inspring.factories
.- Parameters:
resourceLoader
- the delegate resource loaderspringFactoriesLoader
- theSpringFactoriesLoader
used to loadProtocolResolvers
- Returns:
- a
ResourceLoader
instance - Since:
- 3.4.0
-
get()