Closed tzie0062 closed 3 years ago
Thanks for report. @DynamicPropertySource
is evaluated after processing config data imports. At the time Vault is imported as config data source, the @DynamicPropertySource
method was not yet invoked.
This question was already raised in the Spring Boot issue tracker, see https://github.com/spring-projects/spring-boot/issues/26148
Description When using
TestContainers
to start aVault
container, the port that is exposed by the container is randomly selected during startup. Using a@DynamicPropertySource
to override propertiesdoes not work since Spring Cloud Vault does not seem to "see" the added properties.
The issue is present in
Spring-Boot 2.5.1
andSpring-Cloud-Vault-Config 3.0.3
.Sample This sample shows the issue.
When using
Spring-Vault
with a@VaultPropertySource
instead ofSpring-Cloud-Vault
things work as expected.