spring-attic / spring-cloud-aws

All development has moved to https://github.com/awspring/spring-cloud-aws Integration for Amazon Web Services APIs with Spring
https://awspring.io/
Apache License 2.0
589 stars 376 forks source link

Jackson Naming Strategy SNAKE_CASE Incompatible SQS/SNS #711

Open pedrorlmarques opened 3 years ago

pedrorlmarques commented 3 years ago

Spring give us the possibility to set the property spring.jackson.property-naming-strategy. When setting to SNAKE_CASE the expectation is that all fields much have that format. But want happens is that the property is ignored all fields are on camelCase.

WorkAround: If I annotate the field with @JsonProperty and explicit write in snake_case the field is correctly formatted.

Application Property

cloud.aws.region.auto=false spring.jackson.property-naming-strategy=SNAKE_CASE cloud.aws.region.static=eu-west-1 cloud.aws.stack.auto=false

Configuration Class of AWS Components

` @TestConfiguration

public class LocalStackAmazonTestConfiguration {

@Bean
public AmazonSQS amazonSQS() {
    return AmazonSQSAsyncClientBuilder.standard()
            .withCredentials(LocalStackContainerTestingSupport.localStack.getDefaultCredentialsProvider())
            .withEndpointConfiguration(LocalStackContainerTestingSupport.localStack.getEndpointConfiguration(LocalStackContainer.Service.SQS))
            .build();
}

@Bean
public AmazonSNS amazonSNS() {
    return AmazonSNSAsyncClientBuilder.standard()
            .withCredentials(LocalStackContainerTestingSupport.localStack.getDefaultCredentialsProvider())
            .withEndpointConfiguration(LocalStackContainerTestingSupport.localStack.getEndpointConfiguration(LocalStackContainer.Service.SNS))
            .build();
}

@Bean
public NotificationMessagingTemplate notificationMessagingTemplate(final AmazonSNS amazonSNS) {
    return new NotificationMessagingTemplate(amazonSNS);
}

@Bean
public QueueMessagingTemplate queueMessagingTemplate(final AmazonSQSAsync amazonSQS) {
    return new QueueMessagingTemplate(amazonSQS);
}

@Bean
public MappingJackson2MessageConverter mappingJackson2MessageConverter(final ObjectMapper objectMapper) {
    MappingJackson2MessageConverter jackson2MessageConverter = new MappingJackson2MessageConverter();
    jackson2MessageConverter.setObjectMapper(objectMapper);
    return jackson2MessageConverter;
}

} `

Version spring-cloud-starter-aws-messaging :2.2.4.RELEASE

Is this behaviour supposed to happen ?