Class AwsAutoConfiguration


  • @Configuration
    @EnableConfigurationProperties
    @AutoConfigureAfter({io.awspring.cloud.autoconfigure.context.ContextCredentialsAutoConfiguration.class,io.awspring.cloud.autoconfigure.context.ContextInstanceDataAutoConfiguration.class,io.awspring.cloud.autoconfigure.context.ContextRegionProviderAutoConfiguration.class,io.awspring.cloud.autoconfigure.context.ContextResourceLoaderAutoConfiguration.class,io.awspring.cloud.autoconfigure.context.ContextStackAutoConfiguration.class})
    @ConditionalOnBean(com.amazonaws.auth.AWSCredentialsProvider.class)
    public class AwsAutoConfiguration
    extends java.lang.Object
    Spring Boot auto configuration for AWS related beans for the Genie Agent. Should be configured after all the Spring Cloud AWS context configurations are complete.
    Since:
    4.0.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int S3_JOB_ARCHIVER_PRECEDENCE
      Constant for the precedence of the S3 job archive implementation for others to reference if need be.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.amazonaws.regions.AwsRegionProvider awsRegionProvider​(io.awspring.cloud.autoconfigure.context.properties.AwsRegionProperties awsRegionProperties)
      Get an AWS region provider instance.
      io.awspring.cloud.autoconfigure.context.properties.AwsS3ResourceLoaderProperties awsS3ResourceLoaderProperties()
      Provide a configuration properties bean for Spring Cloud resource loader properties if for whatever reason the ContextResourceLoaderAutoConfiguration isn't applied by the agent app.
      S3ClientFactory s3ClientFactory​(com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider, com.amazonaws.regions.AwsRegionProvider awsRegionProvider, org.springframework.core.env.Environment environment)
      Provide a lazy S3ClientFactory instance if one is needed by the system.
      S3JobArchiverImpl s3JobArchiver​(S3ClientFactory s3ClientFactory)
      Provide an implementation of JobArchiver to handle archiving to S3.
      S3ProtocolResolver s3ProtocolResolver​(io.awspring.cloud.autoconfigure.context.properties.AwsS3ResourceLoaderProperties resourceLoaderProperties, S3ClientFactory s3ClientFactory)
      Provide an protocol resolver which will allow resources with s3:// prefixes to be resolved by the application ResourceLoader provided this bean is eventually added to the context via the ConfigurableApplicationContext.addProtocolResolver(ProtocolResolver) method.
      S3ProtocolResolverRegistrar s3ProtocolResolverRegistrar​(S3ProtocolResolver s3ProtocolResolver)
      Configurer bean which will add the S3ProtocolResolver to the set of ProtocolResolver in the application context.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • S3_JOB_ARCHIVER_PRECEDENCE

        public static final int S3_JOB_ARCHIVER_PRECEDENCE
        Constant for the precedence of the S3 job archive implementation for others to reference if need be.
        See Also:
        Ordered, Constant Field Values
    • Constructor Detail

      • AwsAutoConfiguration

        public AwsAutoConfiguration()
    • Method Detail

      • awsRegionProvider

        @Bean
        @ConditionalOnMissingBean(com.amazonaws.regions.AwsRegionProvider.class)
        public com.amazonaws.regions.AwsRegionProvider awsRegionProvider​(io.awspring.cloud.autoconfigure.context.properties.AwsRegionProperties awsRegionProperties)
        Get an AWS region provider instance. The rules for this basically follow what Spring Cloud AWS does but uses the interface from the AWS SDK instead and provides a sensible default.

        See: Spring Cloud AWS Region Documentation

        Parameters:
        awsRegionProperties - The cloud.aws.region.* properties
        Returns:
        A region provider based on whether static was set by user, else auto, else default of us-east-1
      • s3ClientFactory

        @Bean
        @ConditionalOnMissingBean(S3ClientFactory.class)
        public S3ClientFactory s3ClientFactory​(com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider,
                                               com.amazonaws.regions.AwsRegionProvider awsRegionProvider,
                                               org.springframework.core.env.Environment environment)
        Provide a lazy S3ClientFactory instance if one is needed by the system.
        Parameters:
        awsCredentialsProvider - The AWSCredentialsProvider to use
        awsRegionProvider - The AwsRegionProvider to use
        environment - The Spring application Environment to bind properties from
        Returns:
        A S3ClientFactory instance
      • awsS3ResourceLoaderProperties

        @Bean
        @ConditionalOnMissingBean(io.awspring.cloud.autoconfigure.context.properties.AwsS3ResourceLoaderProperties.class)
        @ConfigurationProperties("cloud.aws.loader")
        public io.awspring.cloud.autoconfigure.context.properties.AwsS3ResourceLoaderProperties awsS3ResourceLoaderProperties()
        Provide a configuration properties bean for Spring Cloud resource loader properties if for whatever reason the ContextResourceLoaderAutoConfiguration isn't applied by the agent app.
        Returns:
        A AwsS3ResourceLoaderProperties instance with the bindings from cloud.aws.loader values
      • s3ProtocolResolver

        @Bean
        @ConditionalOnMissingBean(S3ProtocolResolver.class)
        public S3ProtocolResolver s3ProtocolResolver​(io.awspring.cloud.autoconfigure.context.properties.AwsS3ResourceLoaderProperties resourceLoaderProperties,
                                                     S3ClientFactory s3ClientFactory)
        Provide an protocol resolver which will allow resources with s3:// prefixes to be resolved by the application ResourceLoader provided this bean is eventually added to the context via the ConfigurableApplicationContext.addProtocolResolver(ProtocolResolver) method.
        Parameters:
        resourceLoaderProperties - The AwsS3ResourceLoaderProperties instance to use
        s3ClientFactory - The S3ClientFactory instance to use
        Returns:
        A S3ProtocolResolver instance