Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Jackson Naming Strategy SNAKE_CASE Incompatible SQS/SNS #711

Open
pedrorlmarques opened this issue Oct 29, 2020 · 0 comments
Open

Jackson Naming Strategy SNAKE_CASE Incompatible SQS/SNS #711

pedrorlmarques opened this issue Oct 29, 2020 · 0 comments

Comments

@pedrorlmarques
Copy link

pedrorlmarques commented Oct 29, 2020

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 ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants