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 initialEnvironment
ResourceLoader
- 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 (BootstrapContext
orBootstrapRegistry
may 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 TypeMethodDescriptionboolean
isResolvable
(ConfigDataLocationResolverContext context, ConfigDataLocation location) Returns if the specified location address can be resolved by this resolver.resolve
(ConfigDataLocationResolverContext context, ConfigDataLocation location) Resolve aConfigDataLocation
into one or moreConfigDataResource
instances.resolveProfileSpecific
(ConfigDataLocationResolverContext context, ConfigDataLocation location, Profiles profiles) Resolve aConfigDataLocation
into one or moreConfigDataResource
instances 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 aConfigDataLocation
into one or moreConfigDataResource
instances.- Parameters:
context
- the location resolver contextlocation
- the location that should be resolved- Returns:
- a list of
resources
in 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 aConfigDataLocation
into one or moreConfigDataResource
instances 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
-