Java spring core aws消息通知模板未正确绑定消息
我正在使用spring-boot-2.2.1以及AWS SNS和SQS。我正在从SNS向SQS发布一条消息。我可以使用字符串接收消息,但@NotificationMessage返回null而不是消息正文。当我使用spring-boot-1.5.19时,同样的代码运行良好 pom.xmlJava spring core aws消息通知模板未正确绑定消息,java,spring,spring-boot,amazon-sqs,amazon-sns,Java,Spring,Spring Boot,Amazon Sqs,Amazon Sns,我正在使用spring-boot-2.2.1以及AWS SNS和SQS。我正在从SNS向SQS发布一条消息。我可以使用字符串接收消息,但@NotificationMessage返回null而不是消息正文。当我使用spring-boot-1.5.19时,同样的代码运行良好 pom.xml <parent> <groupId>org.springframework.boot</groupId> <artifactId>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-aws-messaging</artifactId>
</dependency>
SQS侦听器类
@SqsListener(value = "${sqs.consumer.name}")
public void receiveSnsSqs(String message, @NotificationMessage Employee employee) {
System.out.println("SNS Consumer received the message::"+message);
System.out.println("SNS Consumer received the notificationMessage::"+employee);
}
在上面的listener类中,我可以接收消息,但该员工的消息为null。我直接从AWS SNS发送消息
正如我所提到的,在将spring版本迁移到2.2.1版本之后,它在停止工作之前工作正常
任何帮助都将不胜感激
@SqsListener(value = "${sqs.consumer.name}")
public void receiveSnsSqs(String message, @NotificationMessage Employee employee) {
System.out.println("SNS Consumer received the message::"+message);
System.out.println("SNS Consumer received the notificationMessage::"+employee);
}