Consistent validation of annotated methods behind AOP proxies
Issue: SPR-13816
This commit is contained in:
@@ -284,6 +284,17 @@ public class AnnotationDrivenEventListenerTests {
|
||||
this.eventCollector.assertTotalEventsCount(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void privateMethodOnCglibProxyFails() throws Exception {
|
||||
try {
|
||||
load(CglibProxyWithPrivateMethod.class);
|
||||
fail("Should have thrown BeanInitializationException");
|
||||
}
|
||||
catch (BeanInitializationException ex) {
|
||||
assertTrue(ex.getCause() instanceof IllegalStateException);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void eventListenerWorksWithCustomScope() throws Exception {
|
||||
load(CustomScopeTestBean.class);
|
||||
@@ -790,6 +801,17 @@ public class AnnotationDrivenEventListenerTests {
|
||||
}
|
||||
|
||||
|
||||
@Component
|
||||
@Scope(proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||
static class CglibProxyWithPrivateMethod extends AbstractTestEventListener {
|
||||
|
||||
@EventListener
|
||||
private void handleIt(TestEvent event) {
|
||||
collectEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Component
|
||||
@Scope(scopeName = "custom", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||
static class CustomScopeTestBean extends AbstractTestEventListener {
|
||||
|
||||
Reference in New Issue
Block a user