作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在 java 中使用谷歌视觉库。这些步骤指定我需要设置我的身份验证凭据才能开始使用 this图书馆 。我能够从 API 控制台凭据页面生成我的 json 属性文件,并将其放置在资源文件夹中的 Spring Boot 应用程序中。
我认为更新了我的 application.properties 文件以包含如下值:
GOOGLE_APPLICATION_CREDENTIALS=datg-avatar-generator-9dc9155cd5bd.json
@PropertySource("${GOOGLE_APPLICATION_CREDENTIALS}")
java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
最佳答案
我能够使用 Spring Cloud GCP spring-cloud-gcp-starter-data-datastore 配置此属性,创建服务帐户项目所有者,将 JSON 私钥复制到主资源目录,并在应用程序中设置以下属性。特性
spring.cloud.gcp.project-id=<project-id>
spring.cloud.gcp.credentials.location=classpath:<credentials-private-key>.json
来自
documentation
关于java - 如何在 Spring Boot 应用程序中设置 GOOGLE_APPLICATION_CREDENTIALS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46921518/
我是一名优秀的程序员,十分优秀!