Google cloud platform GCP secret manager返回连接字符串本身,如何让它返回我的秘密?
我在GCP上有一个秘密,即问候语的秘密值是“你好”。在我的应用程序中,我有以下代码Google cloud platform GCP secret manager返回连接字符串本身,如何让它返回我的秘密?,google-cloud-platform,google-secret-manager,Google Cloud Platform,Google Secret Manager,我在GCP上有一个秘密,即问候语的秘密值是“你好”。在我的应用程序中,我有以下代码 @Value("${sm://projects/221608087928/secrets/greeting}") private String databasePassword; @RequestMapping(value ="/test-user") public String getUser() return this.databasePassword;
@Value("${sm://projects/221608087928/secrets/greeting}")
private String databasePassword;
@RequestMapping(value ="/test-user")
public String getUser()
return this.databasePassword;
}
通过运行以下命令,我获得了值(projects/221608087928/secrets/greeting)
gcloud secrets describe "$secret_name"| grep name
我假设我的浏览器返回“Hello”。但是它返回“//projects/221608087928/secrets/greeting”。我的POM中安装了gcp secret manager依赖项。如何让以下代码返回机密值?通过从更新依赖项来解决
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-secretmanager</artifactId>
<version>1.2.2.RELEASE</version>
</dependency>
org.springframework.cloud
spring cloud gcp starter secretmanager
1.2.2.1发布
到
org.springframework.cloud
spring cloud gcp starter secretmanager
1.2.3.构建快照
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-secretmanager</artifactId>
<version>1.2.3.BUILD-SNAPSHOT</version>
</dependency>