DATACMNS-1113 - Domain event publication now happens for all methods starting with save….
Previously we explicitly intercepted repository methods named save(…) and saveAll(…) which unfortunately results in custom variants of that (e.g. JpaRepository's saveAndFlush(…)) not causing event publication. We now publish events for methods whose names start with save….
This commit is contained in:
@@ -21,7 +21,6 @@ import java.lang.reflect.Method;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
@@ -90,7 +89,7 @@ public class EventPublishingRepositoryProxyPostProcessor implements RepositoryPr
|
||||
|
||||
Object result = invocation.proceed();
|
||||
|
||||
if (!Stream.of("save", "saveAll").anyMatch(it -> invocation.getMethod().getName().equals(it))) {
|
||||
if (!invocation.getMethod().getName().startsWith("save")) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user