Class VaultPropertySourceLocatorSupport
java.lang.Object
org.springframework.cloud.vault.config.VaultPropertySourceLocatorSupport
- All Implemented Interfaces:
org.springframework.cloud.bootstrap.config.PropertySourceLocator
public abstract class VaultPropertySourceLocatorSupport
extends Object
implements org.springframework.cloud.bootstrap.config.PropertySourceLocator
Abstract
PropertySourceLocator to create PropertySources based on
VaultKeyValueBackendProperties and SecretBackendMetadata.- Author:
- Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionVaultPropertySourceLocatorSupport(String propertySourceName, PropertySourceLocatorConfiguration propertySourceLocatorConfiguration) Creates a newVaultPropertySourceLocatorSupportgiven aPropertySourceLocatorConfiguration. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.core.env.CompositePropertySourcecreateCompositePropertySource(org.springframework.core.env.Environment environment) Creates aCompositePropertySource.protected abstract org.springframework.core.env.PropertySource<?> CreateVaultPropertySourceinitialized with aSecretBackendMetadata.protected org.springframework.core.env.CompositePropertySourcedoCreateCompositePropertySource(String propertySourceName, List<org.springframework.core.env.PropertySource<?>> propertySources) protected List<org.springframework.core.env.PropertySource<?>> doCreateKeyValuePropertySources(org.springframework.core.env.Environment environment) CreatePropertySources using the kv secret backend.protected List<org.springframework.core.env.PropertySource<?>> doCreatePropertySources(org.springframework.core.env.Environment environment) CreatePropertySources givenEnvironmentfrom the property configuration.protected voidinitialize(org.springframework.core.env.CompositePropertySource propertySource) Allows initialization thePropertySourcebefore use.org.springframework.core.env.PropertySource<?> locate(org.springframework.core.env.Environment environment) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.cloud.bootstrap.config.PropertySourceLocator
locateCollection
-
Constructor Details
-
VaultPropertySourceLocatorSupport
public VaultPropertySourceLocatorSupport(String propertySourceName, PropertySourceLocatorConfiguration propertySourceLocatorConfiguration) Creates a newVaultPropertySourceLocatorSupportgiven aPropertySourceLocatorConfiguration.- Parameters:
propertySourceName- must not be null or empty.propertySourceLocatorConfiguration- must not be null.- Since:
- 1.1
-
-
Method Details
-
locate
public org.springframework.core.env.PropertySource<?> locate(org.springframework.core.env.Environment environment) - Specified by:
locatein interfaceorg.springframework.cloud.bootstrap.config.PropertySourceLocator
-
initialize
protected void initialize(org.springframework.core.env.CompositePropertySource propertySource) Allows initialization thePropertySourcebefore use. Implementations may override this method to preload properties in thePropertySource.- Parameters:
propertySource- must not be null.
-
createCompositePropertySource
protected org.springframework.core.env.CompositePropertySource createCompositePropertySource(org.springframework.core.env.Environment environment) Creates aCompositePropertySource.- Parameters:
environment- must not be null.- Returns:
- the composite
PropertySource.
-
doCreatePropertySources
protected List<org.springframework.core.env.PropertySource<?>> doCreatePropertySources(org.springframework.core.env.Environment environment) CreatePropertySources givenEnvironmentfrom the property configuration.- Parameters:
environment- must not be null.- Returns:
- a
Listof orderedPropertySources.
-
doCreateKeyValuePropertySources
protected List<org.springframework.core.env.PropertySource<?>> doCreateKeyValuePropertySources(org.springframework.core.env.Environment environment) CreatePropertySources using the kv secret backend. Property sources for the kv secret backend derive from the application name and active profiles to generate context paths.- Parameters:
environment- must not be null.- Returns:
ListofPropertySources.
-
doCreateCompositePropertySource
protected org.springframework.core.env.CompositePropertySource doCreateCompositePropertySource(String propertySourceName, List<org.springframework.core.env.PropertySource<?>> propertySources) - Parameters:
propertySourceName- the property source name.propertySources- the property sources.- Returns:
- the
CompositePropertySourceto use.
-
createVaultPropertySource
protected abstract org.springframework.core.env.PropertySource<?> createVaultPropertySource(SecretBackendMetadata accessor) CreateVaultPropertySourceinitialized with aSecretBackendMetadata.- Parameters:
accessor- theSecretBackendMetadata.- Returns:
- the
VaultPropertySourceto use.
-