Annotation Interface ApplicationModuleListener
@Async
@Transactional(propagation=REQUIRES_NEW)
@TransactionalEventListener
@Documented
@Target({METHOD,ANNOTATION_TYPE})
@Retention(RUNTIME)
public @interface ApplicationModuleListener
An
ApplicationModuleListener
is an Async
Spring TransactionalEventListener
that runs in a
transaction itself. Thus, the annotation serves as syntactic sugar for the generally recommend setup to integrate
application modules via events. The setup makes sure that an original business transaction completes successfully and
the integration asynchronously runs in a transaction itself to decouple the integration as much as possible from the
original unit of work.
It is advisable that you use these integration listeners in combination with the Spring Modulith Event Publication Registry to make sure that the event publication does not get lost in case of an application or listener failure.
- Author:
- Oliver Drotbohm
- See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionSpring Expression Language (SpEL) attribute used for making the event handling conditional.An optional identifier for the listener, defaulting to the fully-qualified signature of the declaring method (e.g.boolean
Whether the transaction to be run for the event listener is supposed to be read-only (default false).
-
Element Details
-
readOnlyTransaction
@AliasFor(annotation=org.springframework.transaction.annotation.Transactional.class, attribute="readOnly") boolean readOnlyTransactionWhether the transaction to be run for the event listener is supposed to be read-only (default false).- Default:
- false
-
id
@AliasFor(annotation=org.springframework.context.event.EventListener.class, attribute="id") String idAn optional identifier for the listener, defaulting to the fully-qualified signature of the declaring method (e.g. "mypackage.MyClass.myMethod()").- Since:
- 1.1
- See Also:
- Default:
- ""
-
condition
@AliasFor(annotation=org.springframework.context.event.EventListener.class, attribute="condition") String conditionSpring Expression Language (SpEL) attribute used for making the event handling conditional. The default is""
, meaning the event is always handled.- Since:
- 1.2
- See Also:
- Default:
- ""
-