Vault Integration with Spring Boot | Difference Between Spring-Vault-Core & Spring-Cloud-Starter-Vault-Config Dependency

I am trying to integrate Vault with my Spring Boot application. This is a POC to know what is possible with Vault. I am new to both Vault and Spring Boot and I am finding it difficult to do the integration.

I am using spring-vault-core.

My Vault properties file looks like this - (resources/vault-config.properties)

vault.token=hvs.bCy7GFW1HtSrioVK85mG1SIg
vault.uri=
vault.authentication=TOKEN

My Vault configuration file look like -

package com.playground.spring.vault.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.vault.config.EnvironmentVaultConfiguration;
@Configuration
@PropertySource(value = { "vault-config.properties" })
@Import(value = EnvironmentVaultConfiguration.class)
public class VaultEnvironmentConfig {
}

I am facing the problem with Auth with Vault returning 403 to the Java application.

On debugging, I found out that my token is not being read properly in the EnvironmentVaultConfiguration class.

While all the other properties like Uri and authentication are being correctly read.

It would be helpful if someone points me to the direction why this could happen.

Also, I would like to know what is the difference between using spring-vault-core & spring-cloud-starter-vault-config dependency.

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article