Avoid repeated exposure of SpringProxy/Advised for fallback interfaces as well

Issue: SPR-12870
This commit is contained in:
Juergen Hoeller
2015-04-01 18:54:47 +02:00
parent 514eb4281c
commit e1395a6c68
2 changed files with 27 additions and 3 deletions

View File

@@ -26,7 +26,9 @@ import org.aopalliance.intercept.MethodInvocation;
import org.junit.Test;
import org.springframework.aop.TargetSource;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.aop.support.AopUtils;
import org.springframework.aop.target.SingletonTargetSource;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
@@ -222,7 +224,7 @@ public final class AutoProxyCreatorTests {
sac.registerSingleton("containerCallbackInterfacesOnly", ContainerCallbackInterfacesOnly.class);
sac.registerSingleton("singletonNoInterceptor", CustomProxyFactoryBean.class);
sac.registerSingleton("singletonToBeProxied", CustomProxyFactoryBean.class);
sac.registerPrototype("prototypeToBeProxied", CustomProxyFactoryBean.class);
sac.registerPrototype("prototypeToBeProxied", SpringProxyFactoryBean.class);
sac.refresh();
@@ -473,4 +475,25 @@ public final class AutoProxyCreatorTests {
}
}
public static class SpringProxyFactoryBean implements FactoryBean<ITestBean> {
private final TestBean tb = new TestBean();
@Override
public ITestBean getObject() {
return ProxyFactory.getProxy(ITestBean.class, new SingletonTargetSource(tb));
}
@Override
public Class<?> getObjectType() {
return ITestBean.class;
}
@Override
public boolean isSingleton() {
return false;
}
}
}