下面是我的bootstrap.yml
文件:
spring.application.name: backend
spring.cloud.vault:
host: localhost
port: 8200
scheme: http
authentication: token
token: root
我的秘密位于secret/backend
我正在尝试在控制器类中读取这些秘密,如下所示:
@Value("${masterpassword}")
private String masterPassword;
但这导致IllegalArgumentException
春天抱怨它找不到任何东西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}"
有人可以告诉我我做错了什么吗?谢谢你的帮助 :)