Class VaultConfigDataLocationResolver
- java.lang.Object
-
- org.springframework.cloud.vault.config.VaultConfigDataLocationResolver
-
- All Implemented Interfaces:
org.springframework.boot.context.config.ConfigDataLocationResolver<VaultConfigLocation>
public class VaultConfigDataLocationResolver extends Object implements org.springframework.boot.context.config.ConfigDataLocationResolver<VaultConfigLocation>
ConfigDataLocationResolverfor Vault resolvingVaultConfigLocationusing thevault:prefix.Resolution considers contextual locations as we as default locations. Contextual locations such as
vault:secret/my-applicationare considered to be context paths for the Key-Value secrets backend. Using a default locationvault:imports all enabledsecret backendsby creatingSecretBackendMetadatafromSecretBackendMetadataFactory. Note that both types,VaultSecretBackendDescriptorandSecretBackendMetadataFactoryare resolved throughspring.factoriesto 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 individualVaultConfigLocation. By enabling/disablinga 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
VaultConfigurerin theBootstrapRegistry. For example:VaultConfigurer configurer = …; SpringApplication application = …; application.addBootstrapper(registy -> register(VaultConfigurer.class, context -> configurer));
Registers also
VaultPropertiesin theBootstrapRegistrythat is required later on byVaultConfigDataLoader.- Since:
- 3.0
- Author:
- Mark Paluch, Jeffrey van der Laan
- See Also:
VaultConfigurer,BootstrapRegistry,VaultConfigDataLoader
-
-
Constructor Summary
Constructors Constructor Description VaultConfigDataLocationResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisResolvable(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)
-
-
-
Method Detail
-
isResolvable
public boolean isResolvable(org.springframework.boot.context.config.ConfigDataLocationResolverContext context, org.springframework.boot.context.config.ConfigDataLocation location)- Specified by:
isResolvablein interfaceorg.springframework.boot.context.config.ConfigDataLocationResolver<VaultConfigLocation>
-
resolve
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
- Specified by:
resolvein interfaceorg.springframework.boot.context.config.ConfigDataLocationResolver<VaultConfigLocation>- Throws:
org.springframework.boot.context.config.ConfigDataLocationNotFoundExceptionorg.springframework.boot.context.config.ConfigDataResourceNotFoundException
-
resolveProfileSpecific
public 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
- Specified by:
resolveProfileSpecificin interfaceorg.springframework.boot.context.config.ConfigDataLocationResolver<VaultConfigLocation>- Throws:
org.springframework.boot.context.config.ConfigDataLocationNotFoundException
-
-