Browse Source

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.
pull/194/head
Oliver Gierke 9 years ago
parent
commit
dba5308d79
  1. 24
      src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java
  2. 1
      src/main/java/org/springframework/data/repository/support/ReflectionRepositoryInvoker.java

24
src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java

@ -61,6 +61,7 @@ import org.springframework.data.repository.util.ReactiveWrapperConverters; @@ -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; @@ -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, @@ -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, @@ -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

1
src/main/java/org/springframework/data/repository/support/ReflectionRepositoryInvoker.java

@ -135,7 +135,6 @@ class ReflectionRepositoryInvoker implements RepositoryInvoker { @@ -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()//

Loading…
Cancel
Save