Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-build</artifactId>
<version>5.0.0-M1</version>
<version>5.0.0-M4</version>
<relativePath/><!-- lookup parent from repository -->
</parent>

Expand Down
4 changes: 2 additions & 2 deletions spring-cloud-aws-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-metrics</artifactId>
<artifactId>spring-boot-micrometer-metrics</artifactId>
<optional>true</optional>
</dependency>
<dependency>
Expand Down Expand Up @@ -168,7 +168,7 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
<artifactId>spring-boot-starter-aspectj</artifactId>
<optional>true</optional>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.springframework.boot.BootstrapContext;
import org.springframework.boot.BootstrapRegistry;
import org.springframework.boot.ConfigurableBootstrapContext;
import org.springframework.boot.bootstrap.BootstrapContext;
import org.springframework.boot.bootstrap.BootstrapRegistry;
import org.springframework.boot.bootstrap.ConfigurableBootstrapContext;
import org.springframework.boot.context.config.ConfigDataLocation;
import org.springframework.boot.context.config.ConfigDataLocationNotFoundException;
import org.springframework.boot.context.config.ConfigDataLocationResolver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.logging.Log;
import org.springframework.boot.BootstrapRegistry;
import org.springframework.boot.bootstrap.BootstrapRegistry;
import org.springframework.boot.logging.DeferredLogFactory;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.logging.Log;
import org.springframework.boot.BootstrapContext;
import org.springframework.boot.bootstrap.BootstrapContext;
import org.springframework.boot.context.config.ConfigDataLocation;
import org.springframework.boot.context.config.ConfigDataLocationNotFoundException;
import org.springframework.boot.context.config.ConfigDataLocationResolverContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.logging.Log;
import org.springframework.boot.BootstrapContext;
import org.springframework.boot.bootstrap.BootstrapContext;
import org.springframework.boot.context.config.ConfigDataLocation;
import org.springframework.boot.context.config.ConfigDataLocationNotFoundException;
import org.springframework.boot.context.config.ConfigDataLocationResolverContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.logging.Log;
import org.springframework.boot.BootstrapContext;
import org.springframework.boot.bootstrap.BootstrapContext;
import org.springframework.boot.context.config.*;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ private static AwsCredentialsProvider create(@Nullable StsProperties stsProperti

if (stsProperties != null) {
builder.asyncCredentialUpdateEnabled(stsProperties.isAsyncCredentialsUpdate());
propertyMapper.from(stsProperties::getRoleArn).whenNonNull().to(builder::roleArn);
propertyMapper.from(stsProperties::getWebIdentityTokenFile).whenNonNull()
propertyMapper.from(stsProperties::getRoleArn).to(builder::roleArn);
propertyMapper.from(stsProperties::getWebIdentityTokenFile)
.to(b -> builder.webIdentityTokenFile(Paths.get(b)));
propertyMapper.from(stsProperties::getRoleSessionName).whenNonNull().to(builder::roleSessionName);
propertyMapper.from(stsProperties::getRoleSessionName).to(builder::roleSessionName);
}
return builder.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,20 @@ public DynamoDbClient dynamoDbClient(DynamoDbProperties properties, AwsCredentia

PropertyMapper propertyMapper = PropertyMapper.get();
software.amazon.dax.Configuration.Builder configuration = software.amazon.dax.Configuration.builder();
propertyMapper.from(daxProperties.getIdleTimeoutMillis()).whenNonNull()
.to(configuration::idleTimeoutMillis);
propertyMapper.from(daxProperties.getConnectionTtlMillis()).whenNonNull()
.to(configuration::connectionTtlMillis);
propertyMapper.from(daxProperties.getConnectTimeoutMillis()).whenNonNull()
.to(configuration::connectTimeoutMillis);
propertyMapper.from(daxProperties.getRequestTimeoutMillis()).whenNonNull()
.to(configuration::requestTimeoutMillis);
propertyMapper.from(daxProperties.getWriteRetries()).whenNonNull().to(configuration::writeRetries);
propertyMapper.from(daxProperties.getReadRetries()).whenNonNull().to(configuration::readRetries);
propertyMapper.from(daxProperties.getClusterUpdateIntervalMillis()).whenNonNull()
propertyMapper.from(daxProperties.getIdleTimeoutMillis()).to(configuration::idleTimeoutMillis);
propertyMapper.from(daxProperties.getConnectionTtlMillis()).to(configuration::connectionTtlMillis);
propertyMapper.from(daxProperties.getConnectTimeoutMillis()).to(configuration::connectTimeoutMillis);
propertyMapper.from(daxProperties.getRequestTimeoutMillis()).to(configuration::requestTimeoutMillis);
propertyMapper.from(daxProperties.getWriteRetries()).to(configuration::writeRetries);
propertyMapper.from(daxProperties.getReadRetries()).to(configuration::readRetries);
propertyMapper.from(daxProperties.getClusterUpdateIntervalMillis())
.to(configuration::clusterUpdateIntervalMillis);
propertyMapper.from(daxProperties.getEndpointRefreshTimeoutMillis()).whenNonNull()
propertyMapper.from(daxProperties.getEndpointRefreshTimeoutMillis())
.to(configuration::endpointRefreshTimeoutMillis);
propertyMapper.from(daxProperties.getMaxConcurrency()).whenNonNull().to(configuration::maxConcurrency);
propertyMapper.from(daxProperties.getMaxPendingConnectionAcquires()).whenNonNull()
propertyMapper.from(daxProperties.getMaxConcurrency()).to(configuration::maxConcurrency);
propertyMapper.from(daxProperties.getMaxPendingConnectionAcquires())
.to(configuration::maxPendingConnectionAcquires);
propertyMapper.from(daxProperties.getSkipHostNameVerification()).whenNonNull()
propertyMapper.from(daxProperties.getSkipHostNameVerification())
.to(configuration::skipHostNameVerification);

configuration.region(AwsClientBuilderConfigurer.resolveRegion(properties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.metrics.autoconfigure.CompositeMeterRegistryAutoConfiguration;
import org.springframework.boot.metrics.autoconfigure.MetricsAutoConfiguration;
import org.springframework.boot.metrics.autoconfigure.export.simple.SimpleMetricsExportAutoConfiguration;
import org.springframework.boot.micrometer.metrics.autoconfigure.CompositeMeterRegistryAutoConfiguration;
import org.springframework.boot.micrometer.metrics.autoconfigure.MetricsAutoConfiguration;
import org.springframework.boot.micrometer.metrics.autoconfigure.export.simple.SimpleMetricsExportAutoConfiguration;
import org.springframework.boot.micrometer.observation.autoconfigure.ObservationAutoConfiguration;
import org.springframework.context.annotation.Bean;
import software.amazon.awssdk.regions.providers.AwsRegionProvider;
import software.amazon.awssdk.services.cloudwatch.CloudWatchAsyncClient;
Expand All @@ -50,7 +51,7 @@
@AutoConfiguration
@AutoConfigureBefore({ CompositeMeterRegistryAutoConfiguration.class, SimpleMetricsExportAutoConfiguration.class })
@AutoConfigureAfter({ CredentialsProviderAutoConfiguration.class, RegionProviderAutoConfiguration.class,
MetricsAutoConfiguration.class })
ObservationAutoConfiguration.class, MetricsAutoConfiguration.class })
@EnableConfigurationProperties({ CloudWatchRegistryProperties.class, CloudWatchProperties.class })
@ConditionalOnProperty(prefix = "management.cloudwatch.metrics.export", name = "namespace")
@ConditionalOnClass({ CloudWatchAsyncClient.class, CloudWatchMeterRegistry.class, AwsRegionProvider.class })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package io.awspring.cloud.autoconfigure.metrics;

import io.micrometer.cloudwatch2.CloudWatchConfig;
import org.springframework.boot.metrics.autoconfigure.export.properties.StepRegistryPropertiesConfigAdapter;
import org.springframework.boot.micrometer.metrics.autoconfigure.export.properties.StepRegistryPropertiesConfigAdapter;

/**
* Adapter to convert {@link CloudWatchRegistryProperties} to a {@link CloudWatchConfig}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package io.awspring.cloud.autoconfigure.metrics;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.metrics.autoconfigure.export.properties.StepRegistryProperties;
import org.springframework.boot.micrometer.metrics.autoconfigure.export.properties.StepRegistryProperties;

/**
* {@link ConfigurationProperties} for configuring CloudWatch metrics export.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package io.awspring.cloud.autoconfigure.s3;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.awspring.cloud.autoconfigure.AwsSyncClientCustomizer;
import io.awspring.cloud.autoconfigure.core.AwsClientBuilderConfigurer;
import io.awspring.cloud.autoconfigure.core.AwsConnectionDetails;
Expand Down Expand Up @@ -49,6 +48,7 @@
import software.amazon.awssdk.services.s3.S3ClientBuilder;
import software.amazon.awssdk.services.s3.presigner.S3Presigner;
import software.amazon.encryption.s3.S3EncryptionClient;
import tools.jackson.databind.json.JsonMapper;

/**
* {@link AutoConfiguration} for {@link S3Client} and {@link S3ProtocolResolver}.
Expand Down Expand Up @@ -188,13 +188,13 @@ S3Client s3Client(S3ClientBuilder s3ClientBuilder) {
}

@Configuration
@ConditionalOnClass(ObjectMapper.class)
@ConditionalOnClass(JsonMapper.class)
static class Jackson2JsonS3ObjectConverterConfiguration {

@ConditionalOnMissingBean
@Bean
S3ObjectConverter s3ObjectConverter(Optional<ObjectMapper> objectMapper) {
return new Jackson2JsonS3ObjectConverter(objectMapper.orElseGet(ObjectMapper::new));
S3ObjectConverter s3ObjectConverter(Optional<JsonMapper> jsonMapper) {
return new Jackson2JsonS3ObjectConverter(jsonMapper.orElseGet(JsonMapper::new));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,10 @@ S3AsyncClient s3AsyncClient(AwsCredentialsProvider credentialsProvider,
if (this.properties.getCrt() != null) {
S3CrtClientProperties crt = this.properties.getCrt();
PropertyMapper propertyMapper = PropertyMapper.get();
propertyMapper.from(crt::getMaxConcurrency).whenNonNull().to(builder::maxConcurrency);
propertyMapper.from(crt::getTargetThroughputInGbps).whenNonNull().to(builder::targetThroughputInGbps);
propertyMapper.from(crt::getMinimumPartSizeInBytes).whenNonNull().to(builder::minimumPartSizeInBytes);
propertyMapper.from(crt::getInitialReadBufferSizeInBytes).whenNonNull()
.to(builder::initialReadBufferSizeInBytes);
propertyMapper.from(crt::getMaxConcurrency).to(builder::maxConcurrency);
propertyMapper.from(crt::getTargetThroughputInGbps).to(builder::targetThroughputInGbps);
propertyMapper.from(crt::getMinimumPartSizeInBytes).to(builder::minimumPartSizeInBytes);
propertyMapper.from(crt::getInitialReadBufferSizeInBytes).to(builder::initialReadBufferSizeInBytes);
}

return builder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ S3TransferManager s3TransferManager(ObjectProvider<S3AsyncClient> s3AsyncClient)
if (this.properties.getTransferManager() != null) {
S3TransferManagerProperties transferManagerProperties = this.properties.getTransferManager();
PropertyMapper propertyMapper = PropertyMapper.get();
propertyMapper.from(transferManagerProperties::getMaxDepth).whenNonNull()
.to(builder::uploadDirectoryMaxDepth);
propertyMapper.from(transferManagerProperties::getFollowSymbolicLinks).whenNonNull()
propertyMapper.from(transferManagerProperties::getMaxDepth).to(builder::uploadDirectoryMaxDepth);
propertyMapper.from(transferManagerProperties::getFollowSymbolicLinks)
.to(builder::uploadDirectoryFollowSymbolicLinks);
}
return builder.s3Client(s3AsyncClient.getIfAvailable()).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ public void setCrt(@Nullable S3CrtClientProperties crt) {
public S3Configuration toS3Configuration() {
S3Configuration.Builder config = S3Configuration.builder();
PropertyMapper propertyMapper = PropertyMapper.get();
propertyMapper.from(this::getAccelerateModeEnabled).whenNonNull().to(config::accelerateModeEnabled);
propertyMapper.from(this::getChecksumValidationEnabled).whenNonNull().to(config::checksumValidationEnabled);
propertyMapper.from(this::getChunkedEncodingEnabled).whenNonNull().to(config::chunkedEncodingEnabled);
propertyMapper.from(this::getPathStyleAccessEnabled).whenNonNull().to(config::pathStyleAccessEnabled);
propertyMapper.from(this::getUseArnRegionEnabled).whenNonNull().to(config::useArnRegionEnabled);
propertyMapper.from(this::getAccelerateModeEnabled).to(config::accelerateModeEnabled);
propertyMapper.from(this::getChecksumValidationEnabled).to(config::checksumValidationEnabled);
propertyMapper.from(this::getChunkedEncodingEnabled).to(config::chunkedEncodingEnabled);
propertyMapper.from(this::getPathStyleAccessEnabled).to(config::pathStyleAccessEnabled);
propertyMapper.from(this::getUseArnRegionEnabled).to(config::useArnRegionEnabled);
return config.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import static io.awspring.cloud.sns.configuration.NotificationHandlerMethodArgumentResolverConfigurationUtils.getNotificationHandlerMethodArgumentResolver;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.awspring.cloud.autoconfigure.AwsSyncClientCustomizer;
import io.awspring.cloud.autoconfigure.core.AwsClientBuilderConfigurer;
import io.awspring.cloud.autoconfigure.core.AwsConnectionDetails;
Expand All @@ -40,11 +39,12 @@
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
import org.springframework.messaging.converter.JacksonJsonMessageConverter;
import org.springframework.messaging.support.ChannelInterceptor;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import software.amazon.awssdk.services.sns.SnsClient;
import tools.jackson.databind.json.JsonMapper;

/**
* {@link EnableAutoConfiguration Auto-configuration} for SNS integration.
Expand Down Expand Up @@ -78,11 +78,16 @@ public SnsClient snsClient(SnsProperties properties, AwsClientBuilderConfigurer

@ConditionalOnMissingBean(SnsOperations.class)
@Bean
public SnsTemplate snsTemplate(SnsClient snsClient, Optional<ObjectMapper> objectMapper,
public SnsTemplate snsTemplate(SnsClient snsClient, Optional<JsonMapper> jsonMapper,
Optional<TopicArnResolver> topicArnResolver, ObjectProvider<ChannelInterceptor> interceptors) {
MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
JacksonJsonMessageConverter converter;
if (jsonMapper.isPresent()) {
converter = new JacksonJsonMessageConverter(jsonMapper.get());
}
else {
converter = new JacksonJsonMessageConverter();
}
converter.setSerializedPayloadClass(String.class);
objectMapper.ifPresent(converter::setObjectMapper);
SnsTemplate snsTemplate = topicArnResolver.map(it -> new SnsTemplate(snsClient, it, converter))
.orElseGet(() -> new SnsTemplate(snsClient, converter));
interceptors.forEach(snsTemplate::addChannelInterceptor);
Expand Down
Loading