Closed ghost closed 2 years ago
I'm using org.springframework.boot:spring-boot-starter-parent2.6.6 org.springframework.cloud:spring-cloud-vault-parent:310
Found a workaround. properties like spring.cloud.vault.enabled
and spring.config.import
must be separated into profile specific configuration files.
In this example, they had to be moved from application.yml
to application-local.yml
, application-default.yml
, and application-prod.yml
I was able to keep all the other properties in application.yml
I think this is rather a Spring Boot issue as the Config Data API is provided by Spring Boot.
Describe the bug According to the Spring Cloud Vault documentation, I can use the field spring.cloud.vault.enabled to disable connecting to vault in profiles where we don't need the connection.
https://docs.spring.io/spring-cloud-vault/docs/current/reference/html/#vault.configdata.location.optional
However, if I run under a profile where spring.cloud.vault.enabled=true, the application crashes because some of the inactive profiles have spring.cloud.vault.enabled=false.
Reason: org.springframework.boot.context.config.InactiveConfigDataAccessException: Inactive property source 'Config resource 'class path resource [application.yml]' via location 'optional:classpath:/' (document #2)' imported from location 'class path resource [application.yml]' cannot contain property 'spring.cloud.vault.enabled' [origin: class path resource [application.yml] - 67:16]
Sample application.yml: