Interface ConfigDataLoader<R extends ConfigDataResource>
- Type Parameters:
R
- the resource type
- All Known Implementing Classes:
ConfigTreeConfigDataLoader
,StandardConfigDataLoader
public interface ConfigDataLoader<R extends ConfigDataResource>
Strategy class that can be used to load
ConfigData
for a given
ConfigDataResource
. Implementations should be added as spring.factories
entries. The following constructor parameter types are supported:
DeferredLogFactory
- if the loader needs deferred loggingConfigurableBootstrapContext
- A bootstrap context that can be used to store objects that may be expensive to create, or need to be shared (BootstrapContext
orBootstrapRegistry
may also be used).
Multiple loaders cannot claim the same resource.
- Since:
- 2.4.0
- Author:
- Phillip Webb, Madhura Bhave
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
isLoadable
(ConfigDataLoaderContext context, R resource) Returns if the specified resource can be loaded by this instance.load
(ConfigDataLoaderContext context, R resource) LoadConfigData
for the given resource.
-
Method Details
-
isLoadable
Returns if the specified resource can be loaded by this instance.- Parameters:
context
- the loader contextresource
- the resource to check.- Returns:
- if the resource is supported by this loader
-
load
ConfigData load(ConfigDataLoaderContext context, R resource) throws IOException, ConfigDataResourceNotFoundException LoadConfigData
for the given resource.- Parameters:
context
- the loader contextresource
- the resource to load- Returns:
- the loaded config data or
null
if the location should be skipped - Throws:
IOException
- on IO errorConfigDataResourceNotFoundException
- if the resource cannot be found
-