接口 ConfigDataLoader<R extends ConfigDataResource>
- 类型参数:
R
- the resource type
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.
- 从以下版本开始:
- 2.4.0
- 作者:
- Phillip Webb, Madhura Bhave
-
方法概要
修饰符和类型方法说明default 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.
-
方法详细资料
-
isLoadable
Returns if the specified resource can be loaded by this instance.- 参数:
context
- the loader contextresource
- the resource to check.- 返回:
- if the resource is supported by this loader
-
load
ConfigData load(ConfigDataLoaderContext context, R resource) throws IOException, ConfigDataResourceNotFoundException LoadConfigData
for the given resource.- 参数:
context
- the loader contextresource
- the resource to load- 返回:
- the loaded config data or
null
if the location should be skipped - 抛出:
IOException
- on IO errorConfigDataResourceNotFoundException
- if the resource cannot be found
-