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 (BootstrapContextorBootstrapRegistrymay also be used).
Multiple loaders cannot claim the same resource.
- Since:
- 2.4.0
- Author:
- Phillip Webb, Madhura Bhave
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanisLoadable(ConfigDataLoaderContext context, R resource) Returns if the specified resource can be loaded by this instance.load(ConfigDataLoaderContext context, R resource) LoadConfigDatafor 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 LoadConfigDatafor the given resource.- Parameters:
context- the loader contextresource- the resource to load- Returns:
- the loaded config data or
nullif the location should be skipped - Throws:
IOException- on IO errorConfigDataResourceNotFoundException- if the resource cannot be found
-