TransactionAttributeSourcePointcut pointcut skips target classes with TransactionalProxy marker (e.g. Spring Data proxies)

This 4.2 commit also makes TransactionProxyFactoryBean expose the TransactionalProxy marker and refines SpringProxy marker handling.

Issue: SPR-13109
This commit is contained in:
Juergen Hoeller
2015-06-17 13:02:26 +02:00
parent f988151163
commit 9f64230131
6 changed files with 85 additions and 8 deletions

View File

@@ -173,6 +173,8 @@ public abstract class AbstractSingletonProxyFactoryBean extends ProxyConfig
ClassUtils.getAllInterfacesForClass(targetSource.getTargetClass(), this.proxyClassLoader));
}
postProcessProxyFactory(proxyFactory);
this.proxy = proxyFactory.getProxy(this.proxyClassLoader);
}
@@ -191,6 +193,15 @@ public abstract class AbstractSingletonProxyFactoryBean extends ProxyConfig
}
}
/**
* A hook for subclasses to post-process the {@link ProxyFactory}
* before creating the proxy instance with it.
* @param proxyFactory the AOP ProxyFactory about to be used
* @since 4.2
*/
protected void postProcessProxyFactory(ProxyFactory proxyFactory) {
}
@Override
public Object getObject() {

View File

@@ -70,8 +70,8 @@ public class DefaultAopProxyFactory implements AopProxyFactory, Serializable {
* (or no proxy interfaces specified at all).
*/
private boolean hasNoUserSuppliedProxyInterfaces(AdvisedSupport config) {
Class<?>[] interfaces = config.getProxiedInterfaces();
return (interfaces.length == 0 || (interfaces.length == 1 && SpringProxy.class == interfaces[0]));
Class<?>[] ifcs = config.getProxiedInterfaces();
return (ifcs.length == 0 || (ifcs.length == 1 && SpringProxy.class.isAssignableFrom(ifcs[0])));
}
}