Class VaultAutoConfiguration
java.lang.Object
org.springframework.cloud.vault.config.VaultAutoConfiguration
- Direct Known Subclasses:
VaultBootstrapConfiguration
@Configuration(proxyBeanMethods=false)
@ConditionalOnProperty(name="spring.cloud.vault.enabled",
matchIfMissing=true)
@EnableConfigurationProperties(VaultProperties.class)
@Order(2147483642)
public class VaultAutoConfiguration
extends Object
Auto-configuration
for Spring Vault support.- Since:
- 3.0
- Author:
- Spencer Gibb, Mark Paluch
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Wrapper to keepTaskScheduler
local to Spring Cloud Vault. -
Constructor Summary
ConstructorDescriptionVaultAutoConfiguration
(org.springframework.context.ConfigurableApplicationContext applicationContext, VaultProperties vaultProperties, org.springframework.beans.factory.ObjectProvider<org.springframework.vault.client.VaultEndpointProvider> endpointProvider, org.springframework.beans.factory.ObjectProvider<List<org.springframework.vault.client.RestTemplateCustomizer>> customizers, org.springframework.beans.factory.ObjectProvider<List<org.springframework.vault.client.RestTemplateRequestCustomizer<?>>> requestCustomizers) -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.vault.authentication.ClientAuthentication
clientAuthentication
(org.springframework.vault.config.AbstractVaultConfiguration.ClientFactoryWrapper clientFactoryWrapper, org.springframework.vault.client.RestTemplateFactory restTemplateFactory) org.springframework.vault.config.AbstractVaultConfiguration.ClientFactoryWrapper
Creates aAbstractVaultConfiguration.ClientFactoryWrapper
containing aClientHttpRequestFactory
.protected org.springframework.vault.client.RestTemplateBuilder
restTemplateBuilder
(org.springframework.http.client.ClientHttpRequestFactory requestFactory) Create aRestTemplateBuilder
initialized withVaultEndpointProvider
andClientHttpRequestFactory
.org.springframework.vault.client.RestTemplateFactory
vaultRestTemplateFactory
(org.springframework.vault.config.AbstractVaultConfiguration.ClientFactoryWrapper clientFactoryWrapper) Create aRestTemplateFactory
bean that is used to produceRestTemplate
.org.springframework.vault.authentication.SessionManager
vaultSessionManager
(org.springframework.vault.authentication.ClientAuthentication clientAuthentication, org.springframework.beans.factory.ObjectFactory<VaultAutoConfiguration.TaskSchedulerWrapper> asyncTaskExecutorFactory, org.springframework.vault.client.RestTemplateFactory restTemplateFactory) Creates a newVaultAutoConfiguration.TaskSchedulerWrapper
that encapsulates a bean implementingTaskScheduler
andAsyncTaskExecutor
.org.springframework.vault.core.VaultTemplate
vaultTemplate
(org.springframework.vault.config.AbstractVaultConfiguration.ClientFactoryWrapper clientFactoryWrapper) Creates aVaultTemplate
.
-
Constructor Details
-
VaultAutoConfiguration
public VaultAutoConfiguration(org.springframework.context.ConfigurableApplicationContext applicationContext, VaultProperties vaultProperties, org.springframework.beans.factory.ObjectProvider<org.springframework.vault.client.VaultEndpointProvider> endpointProvider, org.springframework.beans.factory.ObjectProvider<List<org.springframework.vault.client.RestTemplateCustomizer>> customizers, org.springframework.beans.factory.ObjectProvider<List<org.springframework.vault.client.RestTemplateRequestCustomizer<?>>> requestCustomizers)
-
-
Method Details
-
restTemplateBuilder
protected org.springframework.vault.client.RestTemplateBuilder restTemplateBuilder(org.springframework.http.client.ClientHttpRequestFactory requestFactory) Create aRestTemplateBuilder
initialized withVaultEndpointProvider
andClientHttpRequestFactory
. May be overridden by subclasses.- Parameters:
requestFactory
- theClientHttpRequestFactory
.- Returns:
- the
RestTemplateBuilder
. - Since:
- 2.3
- See Also:
-
clientHttpRequestFactoryWrapper
@Bean @ConditionalOnMissingBean public org.springframework.vault.config.AbstractVaultConfiguration.ClientFactoryWrapper clientHttpRequestFactoryWrapper()Creates aAbstractVaultConfiguration.ClientFactoryWrapper
containing aClientHttpRequestFactory
.ClientHttpRequestFactory
is not exposed as root bean becauseClientHttpRequestFactory
is configured withClientOptions
andSslConfiguration
which are not necessarily applicable for the whole application.- Returns:
- the
AbstractVaultConfiguration.ClientFactoryWrapper
to wrap aClientHttpRequestFactory
instance.
-
vaultRestTemplateFactory
@Bean @ConditionalOnMissingBean public org.springframework.vault.client.RestTemplateFactory vaultRestTemplateFactory(org.springframework.vault.config.AbstractVaultConfiguration.ClientFactoryWrapper clientFactoryWrapper) Create aRestTemplateFactory
bean that is used to produceRestTemplate
.- Parameters:
clientFactoryWrapper
- theAbstractVaultConfiguration.ClientFactoryWrapper
.- Returns:
- the
RestTemplateFactory
. - Since:
- 3.0
- See Also:
-
vaultTemplate
@Bean @ConditionalOnMissingBean(org.springframework.vault.core.VaultOperations.class) public org.springframework.vault.core.VaultTemplate vaultTemplate(org.springframework.vault.config.AbstractVaultConfiguration.ClientFactoryWrapper clientFactoryWrapper) Creates aVaultTemplate
.- Parameters:
clientFactoryWrapper
- theAbstractVaultConfiguration.ClientFactoryWrapper
.- Returns:
- the
VaultTemplate
bean. - See Also:
-
vaultTaskScheduler
@Bean @Lazy @ConditionalOnMissingBean(TaskSchedulerWrapper.class) public VaultAutoConfiguration.TaskSchedulerWrapper vaultTaskScheduler()Creates a newVaultAutoConfiguration.TaskSchedulerWrapper
that encapsulates a bean implementingTaskScheduler
andAsyncTaskExecutor
.- Returns:
- the
VaultAutoConfiguration.TaskSchedulerWrapper
bean. - See Also:
-
ThreadPoolTaskScheduler
-
vaultSessionManager
@Bean @ConditionalOnMissingBean @ConditionalOnAuthentication public org.springframework.vault.authentication.SessionManager vaultSessionManager(org.springframework.vault.authentication.ClientAuthentication clientAuthentication, org.springframework.beans.factory.ObjectFactory<VaultAutoConfiguration.TaskSchedulerWrapper> asyncTaskExecutorFactory, org.springframework.vault.client.RestTemplateFactory restTemplateFactory) - Parameters:
clientAuthentication
- theClientAuthentication
.asyncTaskExecutorFactory
- theObjectFactory
forVaultAutoConfiguration.TaskSchedulerWrapper
.restTemplateFactory
- theRestTemplateFactory
.- Returns:
- the
SessionManager
for Vault session management. - See Also:
-
SessionManager
LifecycleAwareSessionManager
-
clientAuthentication
@Bean @ConditionalOnMissingBean @ConditionalOnAuthentication public org.springframework.vault.authentication.ClientAuthentication clientAuthentication(org.springframework.vault.config.AbstractVaultConfiguration.ClientFactoryWrapper clientFactoryWrapper, org.springframework.vault.client.RestTemplateFactory restTemplateFactory) - Parameters:
clientFactoryWrapper
- theAbstractVaultConfiguration.ClientFactoryWrapper
.restTemplateFactory
- theRestTemplateFactory
.- Returns:
- the
ClientAuthentication
to obtain aVaultToken
. - See Also:
-
SessionManager
LifecycleAwareSessionManager
-