spring-modulith icon indicating copy to clipboard operation
spring-modulith copied to clipboard

`@DomainEvent` detection does not work with inheritance

Open ajax-semenov-y opened this issue 8 months ago • 4 comments
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.

ajax-semenov-y avatar Mar 20 '25 14:03 ajax-semenov-y