Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poc: add service settings as bean to have more granularity. #4

Open
wants to merge 1 commit into
base: multi-module-w-shared
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ public TransportChannelProvider defaultLanguageTransportChannelProvider() {
}

@Bean
@ConditionalOnMissingBean
public LanguageServiceClient languageServiceClient(@Qualifier("languageServiceCredentials") CredentialsProvider credentialsProvider,
@ConditionalOnMissingBean(name = "languageServiceSettings")
public LanguageServiceSettings languageServiceClient(@Qualifier("languageServiceCredentials") CredentialsProvider credentialsProvider,
@Qualifier("defaultLanguageTransportChannelProvider") TransportChannelProvider defaultTransportChannelProvider)
throws IOException {

Expand Down Expand Up @@ -179,9 +179,16 @@ public LanguageServiceClient languageServiceClient(@Qualifier("languageServiceCr
// ...
clientSettingsBuilder.annotateTextSettings()
.setRetrySettings(annotateTextRetrySettingsBuilder.build());
return clientSettingsBuilder.build();
}

return LanguageServiceClient.create(clientSettingsBuilder.build());
@Bean
@ConditionalOnMissingBean
public LanguageServiceClient languageServiceClient(@Qualifier("languageServiceSettings") LanguageServiceSettings languageServiceSettings)
throws IOException {
return LanguageServiceClient.create(languageServiceSettings);
}

/**
* Returns the "user-agent" header value which should be added to the google-cloud-java REST API
* calls. e.g., {@code Spring-autoconfig/1.0.0.RELEASE spring-autogen-language/1.0.0.RELEASE}.
Expand Down