Class ApplicationResourceLoader
java.lang.Object
org.springframework.core.io.DefaultResourceLoader
org.springframework.boot.io.ApplicationResourceLoader
- All Implemented Interfaces:
- org.springframework.core.io.ResourceLoader
public class ApplicationResourceLoader
extends org.springframework.core.io.DefaultResourceLoader
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
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfaceStrategy interface registered inspring.factoriesand used byApplicationResourceLoaderto determine the file path of loaded resource when it can also be represented as aFileSystemResource.Nested classes/interfaces inherited from class org.springframework.core.io.DefaultResourceLoaderorg.springframework.core.io.DefaultResourceLoader.ClassPathContextResource
- 
Field SummaryFields inherited from interface org.springframework.core.io.ResourceLoaderCLASSPATH_URL_PREFIX
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic org.springframework.core.io.ResourceLoaderget()Return aResourceLoadersupporting additionalProtocolResolversregistered inspring.factories.static org.springframework.core.io.ResourceLoaderget(@Nullable ClassLoader classLoader) Return aResourceLoadersupporting additionalProtocolResolversregistered inspring.factories.static org.springframework.core.io.ResourceLoaderget(@Nullable ClassLoader classLoader, org.springframework.core.io.support.SpringFactoriesLoader springFactoriesLoader) Return aResourceLoadersupporting additionalProtocolResolversregistered inspring.factories.static org.springframework.core.io.ResourceLoaderget(@Nullable ClassLoader classLoader, org.springframework.core.io.support.SpringFactoriesLoader springFactoriesLoader, @Nullable Path workingDirectory) Return aResourceLoadersupporting additionalProtocolResolversregistered inspring.factories.static org.springframework.core.io.ResourceLoaderget(org.springframework.core.io.ResourceLoader resourceLoader) Return aResourceLoaderdelegating to the given resource loader and supporting additionalProtocolResolversregistered inspring.factories.static org.springframework.core.io.ResourceLoaderget(org.springframework.core.io.ResourceLoader resourceLoader, boolean preferFileResolution) Return aResourceLoaderdelegating to the given resource loader and supporting additionalProtocolResolversregistered inspring.factories.static org.springframework.core.io.ResourceLoaderget(org.springframework.core.io.ResourceLoader resourceLoader, org.springframework.core.io.support.SpringFactoriesLoader springFactoriesLoader) Return aResourceLoaderdelegating to the given resource loader and supporting additionalProtocolResolversregistered inspring.factories.protected org.springframework.core.io.ResourcegetResourceByPath(String path) Methods inherited from class org.springframework.core.io.DefaultResourceLoaderaddProtocolResolver, clearResourceCaches, getClassLoader, getProtocolResolvers, getResource, getResourceCache, setClassLoader
- 
Constructor Details- 
ApplicationResourceLoaderpublic ApplicationResourceLoader()
 
- 
- 
Method Details- 
getResourceByPath- Overrides:
- getResourceByPathin class- org.springframework.core.io.DefaultResourceLoader
 
- 
getpublic static org.springframework.core.io.ResourceLoader get()Return aResourceLoadersupporting additionalProtocolResolversregistered 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 ResourceLoaderinstance
- Since:
- 3.4.0
 
- 
getReturn aResourceLoadersupporting additionalProtocolResolversregistered inspring.factories. The factories files and resources will be resolved using the specified class loader.- Parameters:
- classLoader- the class loader to use or- nullto use the default class loader
- Returns:
- a ResourceLoaderinstance
- Since:
- 3.4.0
 
- 
getpublic static org.springframework.core.io.ResourceLoader get(@Nullable ClassLoader classLoader, org.springframework.core.io.support.SpringFactoriesLoader springFactoriesLoader) Return aResourceLoadersupporting additionalProtocolResolversregistered inspring.factories.- Parameters:
- classLoader- the class loader to use or- nullto use the default class loader
- springFactoriesLoader- the- SpringFactoriesLoaderused to load- ProtocolResolvers
- Returns:
- a ResourceLoaderinstance
- Since:
- 3.4.0
 
- 
getpublic static org.springframework.core.io.ResourceLoader get(@Nullable ClassLoader classLoader, org.springframework.core.io.support.SpringFactoriesLoader springFactoriesLoader, @Nullable Path workingDirectory) Return aResourceLoadersupporting additionalProtocolResolversregistered inspring.factories.- Parameters:
- classLoader- the class loader to use or- nullto use the default class loader
- springFactoriesLoader- the- SpringFactoriesLoaderused to load- ProtocolResolvers
- workingDirectory- the working directory
- Returns:
- a ResourceLoaderinstance
- Since:
- 3.5.0
 
- 
getpublic static org.springframework.core.io.ResourceLoader get(org.springframework.core.io.ResourceLoader resourceLoader) Return aResourceLoaderdelegating to the given resource loader and supporting additionalProtocolResolversregistered 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 ResourceLoaderinstance
- Since:
- 3.4.0
 
- 
getpublic static org.springframework.core.io.ResourceLoader get(org.springframework.core.io.ResourceLoader resourceLoader, boolean preferFileResolution) Return aResourceLoaderdelegating to the given resource loader and supporting additionalProtocolResolversregistered 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
- preferFileResolution- if file based resolution is preferred when a suitable- ApplicationResourceLoader.FilePathResolversupport the resource
- Returns:
- a ResourceLoaderinstance
- Since:
- 3.4.1
 
- 
getpublic static org.springframework.core.io.ResourceLoader get(org.springframework.core.io.ResourceLoader resourceLoader, org.springframework.core.io.support.SpringFactoriesLoader springFactoriesLoader) Return aResourceLoaderdelegating to the given resource loader and supporting additionalProtocolResolversregistered inspring.factories.- Parameters:
- resourceLoader- the delegate resource loader
- springFactoriesLoader- the- SpringFactoriesLoaderused to load- ProtocolResolvers
- Returns:
- a ResourceLoaderinstance
- Since:
- 3.4.0
 
 
-