it should definitely work with Object. However, note that if your class has other handlers as well, only the most specific one is actually invoked.
Alternatively, you can also define a parameter of type EventMessage<?>. That will also be invoked for all events, but doesn’t force deserialization unless you use the payload.
Are you using Spring Boot Devtools? We’ve seen issues with that before where classes were loaded using different classloaders, so that Class and Class would not be assignable to each other.
You can debug this by setting a breakpoint in the AnnotationEventListenerAdapter.handle(EventMessage) method. Probable the “canHandle” invocation returns false, because the payload of the message isn’t assignable to Object.
@EventHandler
public void on(EventMessage<?> message) {
sendEventToClient(message, message.getIdentifier());
}
since this fits more the needs I had. But this method wasn’t called, too.
And as Allard pointed out - this was a side effect of using Spring Boot Dev-Tools!
Spring Boot DevTools uses class loading tricks to do the reloading. There is configuration in place to make it work with Axon, but there is always an edge case where things don’t work as expected. We’ll try to look into it.