spring-modulith
spring-modulith copied to clipboard
`@DomainEvent` detection does not work with inheritance
trafficstars
Hello. I use a custom domain event system in my service, and all domain events share the same root interface. I have annotated this interface with the org.jmolecules.event.annotation.DomainEvent annotation:
@DomainEvent
interface DomainEvent
I then have a more specific interface for a subtype of my domain events:
sealed interface PaymentEvent : DomainEvent {
And a concrete event implementation:
data class PaymentCompletedEvent(
....
) : PaymentEvent {
However, the ApplicationModule#publishedEvents remains empty. When I add the @DomainEvent annotation directly to PaymentCompletedEvent, it works.