AbstractGoogleClient-未设置应用程序名称。呼叫Builder#setApplicationName

时间:2018-11-22 02:32:04

标签: java google-cloud-platform spring-cloud-gcp

如何设置GCP应用程序名称?

2018-Nov-22 11:18:18.283 WARN  [http-nio-8080-exec-9] 
c.g.a.c.g.s.AbstractGoogleClient - Application name is not set. 
Call 
Builder#setApplicationName.

我的课堂上有以下构造函数。

private final GoogleCredential googleCredential;
private final String projectId;
private final String zone;
private final String region;

private GcpClient(GcpAccountSettings settings) throws 
  GcpClientException {
    try {
        this.googleCredential = 
  getCredential(settings.getClientEmail(), 
  settings.getPrivateKey());
    } catch (GeneralSecurityException | IOException e) {
        throw new GcpClientException(e);
    }

    this.projectId = settings.getProjectId();
    this.zone = settings.getZone();
    this.region = settings.getRegions();
}

我真的很希望您的帮助。

1 个答案:

答案 0 :(得分:0)

我们可以如下设置应用程序名称。

 Compute compute =
            new Compute.Builder(googleCredential.getTransport(), 
 googleCredential.getJsonFactory(), googleCredential)
                    .setApplicationName(projectId).build();

如果您需要更多详细信息,请点击以下链接 how to set application name