public class VaultConfigDataLocationResolver extends Object implements org.springframework.boot.context.config.ConfigDataLocationResolver<VaultConfigLocation>
ConfigDataLocationResolver for Vault resolving VaultConfigLocation
using the vault: prefix.
Resolution considers contextual locations as we as default locations. Contextual
locations such as vault:secret/my-application are considered to be context
paths for the Key-Value secrets backend. Using a default location vault:
imports all enabled secret backends by creating
SecretBackendMetadata from SecretBackendMetadataFactory. Note that both
types,VaultSecretBackendDescriptor and SecretBackendMetadataFactory are
resolved through spring.factories to allow optional
presence/absence on the class path.
Mixing paths
(spring.config.import=vault:,vault:secret/my-application,vault:secret/other-location)
is possible as each config location creates an individual VaultConfigLocation.
By enabling/disabling a
VaultSecretBackendDescriptor, you can control the amount of secret backends that are
imported through the default location.
You can customize the default location capabilities by registering
VaultConfigurer in the BootstrapRegistry. For example:
VaultConfigurer configurer = …; SpringApplication application = …; application.addBootstrapper(registy -> register(VaultConfigurer.class, context -> configurer));
Registers also VaultProperties in the BootstrapRegistry that is
required later on by VaultConfigDataLoader.
VaultConfigurer,
BootstrapRegistry,
VaultConfigDataLoader| Constructor and Description |
|---|
VaultConfigDataLocationResolver() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isResolvable(org.springframework.boot.context.config.ConfigDataLocationResolverContext context,
org.springframework.boot.context.config.ConfigDataLocation location) |
List<VaultConfigLocation> |
resolve(org.springframework.boot.context.config.ConfigDataLocationResolverContext context,
org.springframework.boot.context.config.ConfigDataLocation location) |
List<VaultConfigLocation> |
resolveProfileSpecific(org.springframework.boot.context.config.ConfigDataLocationResolverContext context,
org.springframework.boot.context.config.ConfigDataLocation location,
org.springframework.boot.context.config.Profiles profiles) |
public boolean isResolvable(org.springframework.boot.context.config.ConfigDataLocationResolverContext context,
org.springframework.boot.context.config.ConfigDataLocation location)
isResolvable in interface org.springframework.boot.context.config.ConfigDataLocationResolver<VaultConfigLocation>public List<VaultConfigLocation> resolve(org.springframework.boot.context.config.ConfigDataLocationResolverContext context, org.springframework.boot.context.config.ConfigDataLocation location) throws org.springframework.boot.context.config.ConfigDataLocationNotFoundException, org.springframework.boot.context.config.ConfigDataResourceNotFoundException
resolve in interface org.springframework.boot.context.config.ConfigDataLocationResolver<VaultConfigLocation>org.springframework.boot.context.config.ConfigDataLocationNotFoundExceptionorg.springframework.boot.context.config.ConfigDataResourceNotFoundExceptionpublic List<VaultConfigLocation> resolveProfileSpecific(org.springframework.boot.context.config.ConfigDataLocationResolverContext context, org.springframework.boot.context.config.ConfigDataLocation location, org.springframework.boot.context.config.Profiles profiles) throws org.springframework.boot.context.config.ConfigDataLocationNotFoundException
resolveProfileSpecific in interface org.springframework.boot.context.config.ConfigDataLocationResolver<VaultConfigLocation>org.springframework.boot.context.config.ConfigDataLocationNotFoundExceptionCopyright © 2022 Pivotal Software, Inc.. All rights reserved.