I am trying to setup @SqsListener
working but I'm gettin this exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simpleMessageListenerContainer' defined in org.springframework.cloud.aws.messaging.config.annotation.SqsConfiguration: Failed to instantiate [org.springframework.cloud.aws.messaging.listener.SimpleMessageListenerContainer]: Factory method 'simpleMessageListenerContainer' threw exception with message: Error creating bean with name 'queueMessageHandler' defined in org.springframework.cloud.aws.messaging.config.annotation.SqsConfiguration: org/springframework/messaging/handler/annotation/support/PayloadArgumentResolver
........
........
Caused by: java.lang.ClassNotFoundException: org.springframework.messaging.handler.annotation.support.PayloadArgumentResolver
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[na:na]
... 44 common frames omitted
From my build.gradle:
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
implementation 'org.springframework.cloud:spring-cloud-aws-messaging:2.2.6.RELEASE'
implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE'
implementation 'org.springframework:spring-messaging:6.0.2'
implementation 'io.awspring.cloud:spring-cloud-starter-aws-messaging:2.4.2'
implementation 'io.awspring.cloud:spring-cloud-aws-dependencies:2.4.2'
implementation 'software.amazon.awssdk:sqs:2.18.38'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
I tried different project setups but it all ending with: Caused by: java.lang.ClassNotFoundException: org.springframework.messaging.handler.annotation.support.PayloadArgumentResolver
I think PayloadArgumentResolver
was deprecated as of Spring 5.2 in favor of PayloadMethodArgumentResolver
.
Is it a bug or a dependencies issue?
Try downgrade the
spring-messaging
to version5.3.24
as a workaround