21 lines
2.2 KiB
Plaintext
21 lines
2.2 KiB
Plaintext
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385) ~[surefire-booter-3.2.5.jar:3.2.5]
|
|
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162) ~[surefire-booter-3.2.5.jar:3.2.5]
|
|
at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507) ~[surefire-booter-3.2.5.jar:3.2.5]
|
|
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495) ~[surefire-booter-3.2.5.jar:3.2.5]
|
|
Caused by: java.lang.IllegalStateException: @TransactionalEventListener method must not be annotated with @Transactional unless when declared as REQUIRES_NEW or NOT_SUPPORTED: public void com.ankurm.modulithdemo.inventory.InventoryManagement.on(com.ankurm.modulithdemo.order.OrderPlaced)
|
|
at org.springframework.transaction.annotation.RestrictedTransactionalEventListenerFactory.createApplicationListener(RestrictedTransactionalEventListenerFactory.java:52) ~[spring-tx-7.0.9.jar:7.0.9]
|
|
at org.springframework.context.event.EventListenerMethodProcessor.processBean(EventListenerMethodProcessor.java:187) ~[spring-context-7.0.9.jar:7.0.9]
|
|
at org.springframework.context.event.EventListenerMethodProcessor.afterSingletonsInstantiated(EventListenerMethodProcessor.java:141) ~[spring-context-7.0.9.jar:7.0.9]
|
|
... 92 common frames omitted
|
|
|
|
2026-10-03T23:49:39.346+05:30 WARN 1623 --- [order-fulfillment] [ main] o.s.test.context.TestContextManager : Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener] to prepare test instance [com.ankurm.modulithdemo.order.OrderFulfillmentIntegrationTests@646af766]
|
|
|
|
Root cause: @ApplicationModuleListener already carries @Transactional(propagation =
|
|
REQUIRES_NEW) as a meta-annotation (confirmed by javap -v on the annotation class itself -
|
|
see the post's "how it really works underneath" section). Redeclaring a plain
|
|
@Transactional (default propagation REQUIRED) on the same method is not harmless
|
|
layering - Spring's RestrictedTransactionalEventListenerFactory refuses to even register
|
|
the listener, and the whole ApplicationContext fails to start. Fixed by deleting the
|
|
redundant @Transactional from InventoryManagement.on(OrderPlaced) and
|
|
ShippingManagement.on(StockReserved).
|