ProxyFactoryBean determines actual proxy class in getObjectType()
AopProxy implementations accept empty Advisor chains for early proxy class creation. Closes gh-29097
This commit is contained in:
@@ -97,12 +97,12 @@ public abstract class AbstractAopProxyTests {
|
||||
* to ensure that it was used appropriately by code.
|
||||
*/
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
public void reset() {
|
||||
mockTargetSource.reset();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
public void verify() {
|
||||
mockTargetSource.verify();
|
||||
}
|
||||
|
||||
@@ -122,16 +122,6 @@ public abstract class AbstractAopProxyTests {
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testNoInterceptorsAndNoTarget() {
|
||||
assertThatExceptionOfType(AopConfigException.class).isThrownBy(() -> {
|
||||
AdvisedSupport pc = new AdvisedSupport(ITestBean.class);
|
||||
//Add no interceptors
|
||||
AopProxy aop = createAopProxy(pc);
|
||||
aop.getProxy();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple test that if we set values we can get them out again.
|
||||
*/
|
||||
|
||||
@@ -92,7 +92,7 @@ public class ProxyFactoryBeanTests {
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setup() throws Exception {
|
||||
DefaultListableBeanFactory parent = new DefaultListableBeanFactory();
|
||||
parent.registerBeanDefinition("target2", new RootBeanDefinition(TestApplicationListener.class));
|
||||
this.factory = new DefaultListableBeanFactory(parent);
|
||||
@@ -473,8 +473,8 @@ public class ProxyFactoryBeanTests {
|
||||
public void testEmptyInterceptorNames() {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(INVALID_CONTEXT, CLASS));
|
||||
assertThatExceptionOfType(BeanCreationException.class).as("Interceptor names cannot be empty").isThrownBy(() ->
|
||||
bf.getBean("emptyInterceptorNames"));
|
||||
assertThat(bf.getBean("emptyInterceptorNames")).isInstanceOf(ITestBean.class);
|
||||
assertThat(Proxy.isProxyClass(bf.getBean("emptyInterceptorNames").getClass())).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -709,6 +709,7 @@ public class ProxyFactoryBeanTests {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Aspect interface
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user