question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failure to load spring.cloud.vault.token when running with spring boot 2.3+

See original GitHub issue

Describe the bug When starting up, spring throws an exception java.lang.IllegalArgumentException: Token (spring.cloud.vault.token) must not be empty. This is with a hard-coded token. I also tried setting it with a system property directly.

Debugging shows that the appropriate setter for the token field in org.springframework.cloud.vault.config.VaultProperties is never called.

The issue is present in spring boot 2.3 and 2.4. It works with spring boot 2.2.

Sample Create a simple spring boot app with spring initializr or similar with 2.3+. The exception will be thrown.

Here is my bootstrap.yaml (redacted, of course):

spring:
  application:
    name: myApp

  cloud:
    vault:
      uri: https://vault.sample.url
      authentication: token
      token: 'abcd.1234'
      kv:
        enabled: true
        application-name: myApp

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
mp911decommented, Jan 20, 2021

With Spring Cloud Vault 3.0, we’ve moved away from the bootstrap context. The bootstrap context is deprecated and requires opt-in. Please define your properties in the application.(properties|yaml) file instead.

0reactions
mp911decommented, Mar 10, 2021

Closing due to lack of activity. If you would like us to look at this issue, please provide additional information and we will re-open the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.IllegalArgumentException: Token (spring.cloud.vault ...
Caused by: java.lang.IllegalArgumentException: Token (spring.cloud.vault.token) must not be empty - Hashicorp Vault ... I'm following Vault ...
Read more >
Spring Cloud Vault
If you want to run Spring Cloud Vault using this quickstart guide you need to configure ... Store the Vault token in the...
Read more >
Secure Secrets using Spring Cloud Config + Vault Example
Hashicorp Vault is a platform to secure, store, and tightly control access to tokens, passwords, certificates, encryption keys for protecting sensitive data and ......
Read more >
spring-cloud/spring-cloud - Gitter
... 30332 --- [ main] o.s.boot.SpringApplication : Application run failed java.lang. ... Any gotcha's to get spring boot to load config from k8s...
Read more >
Read a secret from Azure Key Vault in a Spring Boot application
In this tutorial, you create a Spring Boot app that reads a value ... and run a Spring Boot web application with key...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found