|
|
|
@ -61,6 +61,7 @@ import org.springframework.data.repository.util.ReactiveWrapperConverters; |
|
|
|
import org.springframework.data.repository.util.ReactiveWrappers; |
|
|
|
import org.springframework.data.repository.util.ReactiveWrappers; |
|
|
|
import org.springframework.data.util.Pair; |
|
|
|
import org.springframework.data.util.Pair; |
|
|
|
import org.springframework.data.util.ReflectionUtils; |
|
|
|
import org.springframework.data.util.ReflectionUtils; |
|
|
|
|
|
|
|
import org.springframework.transaction.interceptor.TransactionalProxy; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -73,8 +74,6 @@ import org.springframework.util.Assert; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public abstract class RepositoryFactorySupport implements BeanClassLoaderAware, BeanFactoryAware { |
|
|
|
public abstract class RepositoryFactorySupport implements BeanClassLoaderAware, BeanFactoryAware { |
|
|
|
|
|
|
|
|
|
|
|
private static final Class<?> TRANSACTION_PROXY_TYPE = getTransactionProxyType(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final Map<RepositoryInformationCacheKey, RepositoryInformation> repositoryInformationCache; |
|
|
|
private final Map<RepositoryInformationCacheKey, RepositoryInformation> repositoryInformationCache; |
|
|
|
private final List<RepositoryProxyPostProcessor> postProcessors; |
|
|
|
private final List<RepositoryProxyPostProcessor> postProcessors; |
|
|
|
|
|
|
|
|
|
|
|
@ -230,15 +229,11 @@ public abstract class RepositoryFactorySupport implements BeanClassLoaderAware, |
|
|
|
// Create proxy
|
|
|
|
// Create proxy
|
|
|
|
ProxyFactory result = new ProxyFactory(); |
|
|
|
ProxyFactory result = new ProxyFactory(); |
|
|
|
result.setTarget(target); |
|
|
|
result.setTarget(target); |
|
|
|
result.setInterfaces(new Class[] { repositoryInterface, Repository.class }); |
|
|
|
result.setInterfaces(new Class[] { repositoryInterface, Repository.class, TransactionalProxy.class }); |
|
|
|
|
|
|
|
|
|
|
|
result.addAdvice(SurroundingTransactionDetectorMethodInterceptor.INSTANCE); |
|
|
|
result.addAdvice(SurroundingTransactionDetectorMethodInterceptor.INSTANCE); |
|
|
|
result.addAdvisor(ExposeInvocationInterceptor.ADVISOR); |
|
|
|
result.addAdvisor(ExposeInvocationInterceptor.ADVISOR); |
|
|
|
|
|
|
|
|
|
|
|
if (TRANSACTION_PROXY_TYPE != null) { |
|
|
|
|
|
|
|
result.addInterface(TRANSACTION_PROXY_TYPE); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
postProcessors.forEach(processor -> processor.postProcess(result, information)); |
|
|
|
postProcessors.forEach(processor -> processor.postProcess(result, information)); |
|
|
|
|
|
|
|
|
|
|
|
result.addAdvice(new DefaultMethodInvokingMethodInterceptor()); |
|
|
|
result.addAdvice(new DefaultMethodInvokingMethodInterceptor()); |
|
|
|
@ -376,21 +371,6 @@ public abstract class RepositoryFactorySupport implements BeanClassLoaderAware, |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Returns the TransactionProxy type or {@literal null} if not on the classpath. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private static Class<?> getTransactionProxyType() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
return org.springframework.util.ClassUtils |
|
|
|
|
|
|
|
.forName("org.springframework.transaction.interceptor.TransactionalProxy", null); |
|
|
|
|
|
|
|
} catch (ClassNotFoundException o_O) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* This {@code MethodInterceptor} intercepts calls to methods of the custom implementation and delegates the to it if |
|
|
|
* This {@code MethodInterceptor} intercepts calls to methods of the custom implementation and delegates the to it if |
|
|
|
* configured. Furthermore it resolves method calls to finders and triggers execution of them. You can rely on having |
|
|
|
* configured. Furthermore it resolves method calls to finders and triggers execution of them. You can rely on having |
|
|
|
|