Having an @RabbitHandler annotated method with an abstract payload doesn't work when spring-boot-devtools it's on the classpath, resulting in NoSuchMethodException.

    @RabbitHandler
    public void receive(@Payload StatusMessage message) {
        processor.tryEmitNext(message);
    }

The StatusMessage it's extended by StatusMessageV1. Now when receiving an StatusMessageV1 message, the handler errors out with(using default java serialization):

Caused by: java.lang.NoSuchMethodException: No listener method found in com.example.demo.components.DeviceStatusExchangeListener for class com.example.demo.events.StatusMessageV1
    at org.springframework.amqp.rabbit.listener.adapter.DelegatingInvocableHandler.getHandlerForPayload(DelegatingInvocableHandler.java:209) ~[spring-rabbit-3.0.6.jar:3.0.6]
    ... 19 common frames omitted

If I remove the spring-boot-devtools from classpath everything works as expected. Here it's a minimal example

Note, I'm using spring boot version 3.1.2 with an sts4 IDE.

Comment From: wilkinsona

Thanks for the minimal example. The problem's due to this known limitation. Specifically, the wrong ClassLoader is being used to deserialize the message body into an instance of StatusMessageV1. This will have to be addressed in Spring AMQP so that SimpleMessageConverter (and anywhere else that performs deserialisation) takes the thread context class loader into consideration.