在 yml 上配置时 GCP 凭证为空

问题描述 投票:0回答:0

我正在尝试使用 spring cloud 访问云存储上的 gcp 存储桶... 问题是当我使用环境 GOOGLE_APPLICATION_CREDENTIALS=/User/Downloads/key.json 运行我的应用程序时 存储对象正确加载凭证

enter image description here

但是如果我将 json 密钥文件复制到资源文件夹,并且我想通过 application.yml 传递凭证,正如我在 documentation 上看到的那样,存储对象的属性“凭证”为空,即使应用程序似乎在启动时加载它

应用程序.yml:

spring:
  cloud:
    gcp:
      credentials:
        location: classpath:key.json

enter image description here enter image description here

我错过了什么吗?我必须以其他方式指定凭据吗? 在此先感谢您的帮助!

我正在尝试将凭证密钥 json 文件添加到资源文件夹并在 gcp 上进行验证。

java spring-boot google-cloud-platform google-cloud-storage spring-cloud
© www.soinside.com 2019 - 2024. All rights reserved.