microsoft / azure-spring-boot

Spring Boot Starters for Azure services
MIT License
374 stars 460 forks source link

How can I use the secrets in my Test scope to read property from keyvault @Value("${property}") #845

Closed sudhakarbetha closed 4 years ago

sudhakarbetha commented 4 years ago

Environment

Summary

I cannot use the KeyVault properties in my Tests, even if i define the test for the dependency in my pom.xml

Reproduce steps

Set test for azure-keyvault-secrets-spring-boot-starter in pom.xml I cannot read the KeyVault property in my tests as @Value("${property}") I get them as ${property}

Expected Results

I would need to retrieve the value from the keyvault

Actual Results

$(property} is returned

saragluna commented 4 years ago

Thanks for reaching out. Could you help provide more info, such as how the tests are written or configuration are set?

sudhakarbetha commented 4 years ago

I was able to get this by getting the context to test by @SpringBootTest

saragluna commented 4 years ago

Close this issue for now.