Merge branch '6.0.x'
# Conflicts: # spring-tx/src/main/java/org/springframework/transaction/event/TransactionalApplicationListenerMethodAdapter.java
This commit is contained in:
@@ -158,6 +158,17 @@ public class TransactionalEventListenerTests {
|
||||
getEventCollector().assertNoEventReceived();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void afterCommitWithTransactionalComponentListenerWithInterfaceProxy() {
|
||||
load(TransactionalComponentTestListenerWithInterface.class);
|
||||
this.transactionTemplate.execute(status -> {
|
||||
getContext().publishEvent("SKIP");
|
||||
getEventCollector().assertNoEventReceived();
|
||||
return null;
|
||||
});
|
||||
getEventCollector().assertNoEventReceived();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void afterRollback() {
|
||||
load(AfterCompletionExplicitTestListener.class);
|
||||
@@ -552,6 +563,25 @@ public class TransactionalEventListenerTests {
|
||||
}
|
||||
|
||||
|
||||
interface TransactionalComponentTestInterface {
|
||||
|
||||
void handleAfterCommit(String data);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
@Component
|
||||
static class TransactionalComponentTestListenerWithInterface extends BaseTransactionalTestListener implements
|
||||
TransactionalComponentTestInterface {
|
||||
|
||||
@TransactionalEventListener(condition = "!'SKIP'.equals(#data)")
|
||||
@Override
|
||||
public void handleAfterCommit(String data) {
|
||||
handleEvent(EventCollector.AFTER_COMMIT, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Component
|
||||
static class BeforeCommitTestListener extends BaseTransactionalTestListener {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user