Hi,
After upgrading from spring boot 2.4.4 to 2.5.1 our application fails to startup. Our configuration to read secrets from vault is as below. It works well in 2.4.4 but fails when we upgrade it to 2.5.1
application-dev.yml
spring.config.import: vault://kv/XXXXXXXXXXXXX
This results in the following error message:
***************************
APPLICATION FAILED TO START
***************************
Description:
Config data location 'vault://kv/XXXXXXXX' does not exist
Action:
Check that the value 'vault://kv/XXXXXXXX' at class path resource [application-dev.yml] - 15:23 is correct, or prefix it with 'optional:'
Prefixing with optional does not help in our case; as this is a required configuration for us. Please check.
Thanks, DurgaPrasad
Comment From: wilkinsona
I'm not sure why that would happen. The vault
import should be treated the same way in each case.
If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
Comment From: durgaakshinthala
Hi,
I found the mistake what i was trying to do. As mentioned in the error log; we were trying to load vault config from profile specific yml file (application-dev.yml) file. But as mentioned in the below link spring stops reading profile specific config
https://spring.io/blog/2020/08/14/config-file-processing-in-spring-boot-2-4
Its working till 2.5.0 but completely removed from 2.5.1.
Changed did 1. Removed application-dev.yml and application-prod.yml files 2. Added application.yml with profile specific configs as below
spring:
config:
activate:
on-profile: "dev"
spring.cloud.vault:
host: vault.XXXXX.com
---
spring:
config:
activate:
on-profile: "prod"
spring.cloud.vault:
host: vault.XXXXX.com
Thanks for quick response; i am happy close this ticket.
Thanks, DurgaPrasad
Comment From: thekaleidoscope
@durgaakshinthala I don't understand this, only thing that changed in the profile specific documents is Profiles can no longer be activated from profile specific documents.
How does joining the files help?
Comment From: thekaleidoscope
I think this relates to https://github.com/spring-projects/spring-boot/issues/26960