diff --git a/cloud-language-starter/src/main/java/com/sample/autoconfig/LanguageAutoConfig.java b/cloud-language-starter/src/main/java/com/sample/autoconfig/LanguageAutoConfig.java index 474cc9f..02167f5 100644 --- a/cloud-language-starter/src/main/java/com/sample/autoconfig/LanguageAutoConfig.java +++ b/cloud-language-starter/src/main/java/com/sample/autoconfig/LanguageAutoConfig.java @@ -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 { @@ -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}.