我在GCP上有一个秘密,那就是用秘密值"Hello“打招呼。在我的应用程序中,我有以下代码。
@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依赖项。我怎样才能让下面的代码返回保密值呢?
发布于 2020-12-06 22:13:11
通过更新依赖项解决
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-secretmanager</artifactId>
<version>1.2.2.RELEASE</version>
</dependency>至
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-secretmanager</artifactId>
<version>1.2.3.BUILD-SNAPSHOT</version>
</dependency>https://stackoverflow.com/questions/65167994
复制相似问题