From 6775d11c65f4769e4c4d9f9e222e59d9f1daaf76 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Sat, 8 Aug 2015 10:55:41 +0200 Subject: [PATCH] DATACMNS-749 - RepositoryFactorySupport now registers global ExposeInvocationInterceptor. This frees RepositoryProxyPostProcessors from having to register the interceptor manually and thus prevents it from being registered multiple times. --- .../data/repository/core/support/RepositoryFactorySupport.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java b/src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java index bc301accb..98be452ca 100644 --- a/src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java +++ b/src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java @@ -27,6 +27,7 @@ import java.util.concurrent.ConcurrentHashMap; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; import org.springframework.aop.framework.ProxyFactory; +import org.springframework.aop.interceptor.ExposeInvocationInterceptor; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.BeanClassLoaderAware; import org.springframework.core.GenericTypeResolver; @@ -188,6 +189,8 @@ public abstract class RepositoryFactorySupport implements BeanClassLoaderAware { result.setTarget(target); result.setInterfaces(new Class[] { repositoryInterface, Repository.class }); + result.addAdvice(ExposeInvocationInterceptor.INSTANCE); + if (TRANSACTION_PROXY_TYPE != null) { result.addInterface(TRANSACTION_PROXY_TYPE); }