Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud platform GCP secret manager返回连接字符串本身,如何让它返回我的秘密?_Google Cloud Platform_Google Secret Manager - Fatal编程技术网

Google cloud platform GCP secret manager返回连接字符串本身,如何让它返回我的秘密?

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;

我在GCP上有一个秘密,即问候语的秘密值是“你好”。在我的应用程序中,我有以下代码

@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>