in cloud-spanner-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/SpannerConnectionConfiguration.java [359:394]
public SpannerConnectionConfiguration build() {
try {
if (this.credentials == null) {
this.credentials = GoogleCredentials.getApplicationDefault();
}
} catch (IOException e) {
throw new R2dbcNonTransientResourceException(
"Could not acquire default application credentials", e);
}
if (this.fullyQualifiedDatabaseName != null) {
Matcher matcher = FQDN_PATTERN_PARSE.matcher(this.fullyQualifiedDatabaseName);
if (matcher.find()) {
this.projectId = matcher.group(1);
this.instanceName = matcher.group(2);
this.databaseName = matcher.group(3);
} else {
// should not happen, as database names are pre-validated in the setters.
throw new IllegalArgumentException(
"Invalid database name: " + this.fullyQualifiedDatabaseName);
}
}
SpannerConnectionConfiguration configuration = new SpannerConnectionConfiguration(
this.options, this.projectId, this.instanceName, this.databaseName, this.credentials);
configuration.partialResultSetFetchSize = this.partialResultSetFetchSize;
configuration.ddlOperationTimeout = this.ddlOperationTimeout;
configuration.ddlOperationPollInterval = this.ddlOperationPollInterval;
configuration.usePlainText = this.usePlainText;
configuration.optimizerVersion = this.optimizerVersion;
configuration.readonly = this.readonly;
configuration.autocommit = this.autocommit;
return configuration;
}