Class CloudVisionAutoConfiguration

java.lang.Object
com.google.cloud.spring.autoconfigure.vision.CloudVisionAutoConfiguration

@AutoConfiguration @EnableConfigurationProperties(CloudVisionProperties.class) @ConditionalOnClass(CloudVisionTemplate.class) @ConditionalOnProperty(value="spring.cloud.gcp.vision.enabled", matchIfMissing=true) public class CloudVisionAutoConfiguration extends Object
Provides Spring Beans for using Cloud Vision API.
Since:
1.1
  • Constructor Details

  • Method Details

    • imageAnnotatorClient

      @Bean @ConditionalOnMissingBean public com.google.cloud.vision.v1.ImageAnnotatorClient imageAnnotatorClient() throws IOException
      Configure the Cloud Vision API client ImageAnnotatorClient. The spring-cloud-gcp-starter autowires a CredentialsProvider object that provides the GCP credentials, required to authenticate and authorize Vision API calls.

      Cloud Vision API client implements AutoCloseable, which is automatically honored by Spring bean lifecycle.

      Most of the Google Cloud API clients are thread-safe heavy objects. I.e., it's better to produce a singleton and re-using the client object for multiple requests.

      Returns:
      a Cloud Vision API client
      Throws:
      IOException - if an exception occurs creating the ImageAnnotatorClient
    • cloudVisionTemplate

      @Bean @ConditionalOnMissingBean public CloudVisionTemplate cloudVisionTemplate(com.google.cloud.vision.v1.ImageAnnotatorClient imageAnnotatorClient)
    • cloudVisionExecutor

      @Bean @ConditionalOnMissingBean(name="cloudVisionExecutor") public Executor cloudVisionExecutor()