From e4190c47aaea4b39e314f432f5c0bb9fc7afc404 Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Wed, 1 Nov 2023 23:22:05 +0100 Subject: [PATCH] GH-346 - Allow explicit declaration of identifier in @ApplicationModuleListener. --- .../modulith/events/ApplicationModuleListener.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spring-modulith-events/spring-modulith-events-api/src/main/java/org/springframework/modulith/events/ApplicationModuleListener.java b/spring-modulith-events/spring-modulith-events-api/src/main/java/org/springframework/modulith/events/ApplicationModuleListener.java index 7bc7ada9..f4b86ce4 100644 --- a/spring-modulith-events/spring-modulith-events-api/src/main/java/org/springframework/modulith/events/ApplicationModuleListener.java +++ b/spring-modulith-events/spring-modulith-events-api/src/main/java/org/springframework/modulith/events/ApplicationModuleListener.java @@ -21,6 +21,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.springframework.context.event.EventListener; import org.springframework.core.annotation.AliasFor; import org.springframework.scheduling.annotation.Async; import org.springframework.transaction.annotation.Propagation; @@ -54,4 +55,15 @@ public @interface ApplicationModuleListener { */ @AliasFor(annotation = Transactional.class, attribute = "readOnly") boolean readOnlyTransaction() default false; + + /** + * An optional identifier for the listener, defaulting to the fully-qualified signature of the declaring method (e.g. + * "mypackage.MyClass.myMethod()"). + * + * @since 1.1 + * @see EventListener#id + * @see org.springframework.transaction.event.TransactionalApplicationListener#getListenerId() + */ + @AliasFor(annotation = EventListener.class, attribute = "id") + String id() default ""; }