Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java spring core aws消息通知模板未正确绑定消息_Java_Spring_Spring Boot_Amazon Sqs_Amazon Sns - Fatal编程技术网

Java spring core aws消息通知模板未正确绑定消息

Java 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>

我正在使用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>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);
    }