DATACMNS-867 - Removed conditional guards for the presence of TransactionalProxy.

TransactionalProxy is now available on the classpath by definition, so we don't need the guards anymore.
This commit is contained in:
Oliver Gierke
2016-11-16 18:17:35 +01:00
parent bdd55fc7ab
commit dba5308d79
2 changed files with 2 additions and 23 deletions

View File

@@ -61,6 +61,7 @@ import org.springframework.data.repository.util.ReactiveWrapperConverters;
import org.springframework.data.repository.util.ReactiveWrappers;
import org.springframework.data.util.Pair;
import org.springframework.data.util.ReflectionUtils;
import org.springframework.transaction.interceptor.TransactionalProxy;
import org.springframework.util.Assert;
/**
@@ -73,8 +74,6 @@ import org.springframework.util.Assert;
*/
public abstract class RepositoryFactorySupport implements BeanClassLoaderAware, BeanFactoryAware {
private static final Class<?> TRANSACTION_PROXY_TYPE = getTransactionProxyType();
private final Map<RepositoryInformationCacheKey, RepositoryInformation> repositoryInformationCache;
private final List<RepositoryProxyPostProcessor> postProcessors;
@@ -230,15 +229,11 @@ public abstract class RepositoryFactorySupport implements BeanClassLoaderAware,
// Create proxy
ProxyFactory result = new ProxyFactory();
result.setTarget(target);
result.setInterfaces(new Class[] { repositoryInterface, Repository.class });
result.setInterfaces(new Class[] { repositoryInterface, Repository.class, TransactionalProxy.class });
result.addAdvice(SurroundingTransactionDetectorMethodInterceptor.INSTANCE);
result.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
if (TRANSACTION_PROXY_TYPE != null) {
result.addInterface(TRANSACTION_PROXY_TYPE);
}
postProcessors.forEach(processor -> processor.postProcess(result, information));
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
* configured. Furthermore it resolves method calls to finders and triggers execution of them. You can rely on having

View File

@@ -135,7 +135,6 @@ class ReflectionRepositoryInvoker implements RepositoryInvoker {
* @see org.springframework.data.rest.core.invoke.RepositoryInvoker#invokeFindOne(java.io.Serializable)
*/
@Override
@SuppressWarnings("unchecked")
public <T> T invokeFindOne(Serializable id) {
Method method = methods.getFindOneMethod()//