Class DefaultGcpProjectIdProvider

java.lang.Object
com.google.cloud.spring.core.DefaultGcpProjectIdProvider
All Implemented Interfaces:
GcpProjectIdProvider

public class DefaultGcpProjectIdProvider extends Object implements GcpProjectIdProvider
A project ID provider that wraps ServiceOptions.getDefaultProjectId().
  • Constructor Details

    • DefaultGcpProjectIdProvider

      public DefaultGcpProjectIdProvider()
  • Method Details

    • getProjectId

      public String getProjectId()
      ServiceOptions.getDefaultProjectId() checks for the project ID in the GOOGLE_CLOUD_PROJECT environment variable and the Metadata Server, among others.
      Specified by:
      getProjectId in interface GcpProjectIdProvider
      Returns:
      the project ID in the context