【发布时间】:2020-01-13 05:04:19
【问题描述】:
Google 的视觉 API 的 sample code 显示了这一点:
public static Vision getVisionService() throws IOException, GeneralSecurityException {
GoogleCredential credential =
GoogleCredential.getApplicationDefault().createScoped(VisionScopes.all());
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
return new Vision.Builder(GoogleNetHttpTransport.newTrustedTransport(), jsonFactory, credential)
.setApplicationName(APPLICATION_NAME)
.build();
}
但com.google.api.client.googleapis.auth.oauth2.GoogleCredential 现在已弃用。现在验证上述内容的正确方法是什么?
【问题讨论】:
-
示例代码的 URL 是什么。也许我们可以提出问题来更新示例?
-
@Kolban 现在在上面
-
已打开 GitHub 问题要求更新示例...github.com/GoogleCloudPlatform/java-docs-samples/issues/1942
标签: java google-app-engine google-cloud-platform google-vision