org.springframework.cloud.aws.autoconfigure.context.ContextResourceLoaderAutoConfiguration Java Examples

The following examples show how to use org.springframework.cloud.aws.autoconfigure.context.ContextResourceLoaderAutoConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AwsAutoConfiguration.java    From genie with Apache License 2.0 5 votes vote down vote up
/**
 * Provide a configuration properties bean for Spring Cloud resource loader properties if for whatever reason
 * the {@link ContextResourceLoaderAutoConfiguration} isn't applied by the agent app.
 *
 * @return A {@link AwsS3ResourceLoaderProperties} instance with the bindings from cloud.aws.loader values
 */
@Bean
@ConditionalOnMissingBean(AwsS3ResourceLoaderProperties.class)
@ConfigurationProperties(ContextResourceLoaderAutoConfiguration.AWS_LOADER_PROPERTY_PREFIX)
public AwsS3ResourceLoaderProperties awsS3ResourceLoaderProperties() {
    return new AwsS3ResourceLoaderProperties();
}
 
Example #2
Source File: CommonServicesAutoConfigurationTest.java    From genie with Apache License 2.0 5 votes vote down vote up
/**
 * Make sure when AWS configuration is involved it gives the right configuration.
 */
@Test
void testExpectedContextWithAws() {
    this.contextRunner
        .withPropertyValues(
            "cloud.aws.credentials.useDefaultAwsCredentialsChain=true",
            "cloud.aws.region.auto=false",
            "cloud.aws.region.static=us-east-1",
            "cloud.aws.stack.auto=false"
        )
        .withConfiguration(
            AutoConfigurations.of(
                ContextCredentialsAutoConfiguration.class,
                ContextRegionProviderAutoConfiguration.class,
                ContextResourceLoaderAutoConfiguration.class,
                AwsAutoConfiguration.class
            )
        )
        .run(
            (context) -> {
                Assertions.assertThat(context).hasSingleBean(FileSystemJobArchiverImpl.class);
                Assertions.assertThat(context).hasSingleBean(S3JobArchiverImpl.class);
                Assertions.assertThat(context).hasSingleBean(JobArchiveService.class);

                // TODO: Find a way to test the order
                Assertions
                    .assertThat(context)
                    .getBeans(JobArchiver.class)
                    .size()
                    .isEqualTo(2);
            }
        );
}