I'm trying to instantiate BigQueryTemplate without the environment variable GOOGLE_APPLICATION_CREDENTIALS
.
Steps tried:
- Implemented
CredentialsSupplier
by instantiatingCredentials
and setting location to service account json file. - Instantiated Bean
BigQuery
usingBigQueryOptions::newBuilder()
and setting credentials and project id. - Instantiating Bean BigQueryTemplate using the BigQuery bean created in step 2.
spring-cloud-gcp-dependencies
3.4.0
version is used.
The application executing in VM (non-gcp env).
Another option I tried is adding below properties
- spring.cloud.gcp.bigquery.dataset-name=
datasetname
- spring.cloud.gcp.bigquery.credentials.location=
file:/path/to/json
- spring.cloud.gcp.bigquery.project-id=
project-id
I'm getting below error
com.google.cloud.spring.bigquery.core.BigQueryTemplate,
applog.mthd=lambda$writeJsonStream$0,
applog.line=299, applog.msg=Error:
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.
Please let me know if I have missed any thing. Thanks in advance.