Interface ConfigDataLocationResolver<R extends ConfigDataResource>
- Type Parameters:
R- the location type
- All Known Implementing Classes:
ConfigTreeConfigDataLocationResolver,StandardConfigDataLocationResolver
public interface ConfigDataLocationResolver<R extends ConfigDataResource>
Strategy interface used to resolve
locations into one or
more resources. Implementations should be added as a
spring.factories entries. The following constructor parameter types are
supported:
DeferredLogFactory- if the resolver needs deferred loggingBinder- if the resolver needs to obtain values from the initialEnvironmentResourceLoader- if the resolver needs a resource loaderConfigurableBootstrapContext- 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).
Resolvers may implement Ordered or use the @Order annotation. The
first resolver that supports the given location will be used.
- Since:
- 2.4.0
- Author:
- Phillip Webb, Madhura Bhave
-
Method Summary
Modifier and TypeMethodDescriptionbooleanisResolvable(ConfigDataLocationResolverContext context, ConfigDataLocation location) Returns if the specified location address can be resolved by this resolver.resolve(ConfigDataLocationResolverContext context, ConfigDataLocation location) Resolve aConfigDataLocationinto one or moreConfigDataResourceinstances.resolveProfileSpecific(ConfigDataLocationResolverContext context, ConfigDataLocation location, Profiles profiles) Resolve aConfigDataLocationinto one or moreConfigDataResourceinstances based on available profiles.
-
Method Details
-
isResolvable
Returns if the specified location address can be resolved by this resolver.- Parameters:
context- the location resolver contextlocation- the location to check.- Returns:
- if the location is supported by this resolver
-
resolve
List<R> resolve(ConfigDataLocationResolverContext context, ConfigDataLocation location) throws ConfigDataLocationNotFoundException, ConfigDataResourceNotFoundException Resolve aConfigDataLocationinto one or moreConfigDataResourceinstances.- Parameters:
context- the location resolver contextlocation- the location that should be resolved- Returns:
- a list of
resourcesin ascending priority order. - Throws:
ConfigDataLocationNotFoundException- on a non-optional location that cannot be foundConfigDataResourceNotFoundException- if a resolved resource cannot be found
-
resolveProfileSpecific
default List<R> resolveProfileSpecific(ConfigDataLocationResolverContext context, ConfigDataLocation location, Profiles profiles) throws ConfigDataLocationNotFoundException Resolve aConfigDataLocationinto one or moreConfigDataResourceinstances based on available profiles. This method is called once profiles have been deduced from the contributed values. By default this method returns an empty list.- Parameters:
context- the location resolver contextlocation- the location that should be resolvedprofiles- profile information- Returns:
- a list of resolved locations in ascending priority order.
- Throws:
ConfigDataLocationNotFoundException- on a non-optional location that cannot be found
-