Below is my bootstrap.yml
file:
spring.application.name: backend
spring.cloud.vault:
host: localhost
port: 8200
scheme: http
authentication: token
token: root
My secrets are located at secret/backend
I am trying to read these secrets in a controller class like so:
@Value("${masterpassword}")
private String masterPassword;
but this leads to IllegalArgumentException
as spring complains it cannot find any masterpassword
:
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'secretsController': Injection of autowired dependencies failed;
nested exception is java.lang.IllegalArgumentException:
Could not resolve placeholder 'masterpassword' in value "${masterpassword}"
Can someone please tell me what I am doing wrong? Thanks for your help :)
For me downgrading the spring boot version works. I changed the parent version to:
<version>2.3.0.RELEASE</version>
and the spring cloud version to:<spring-cloud.version>Hoxton.SR1</spring-cloud.version>