TargetSource.getTarget() is nullable again (for compatibility with MethodInvocation.getThis)
Issue: SPR-15651
This commit is contained in:
@@ -35,6 +35,7 @@ import org.springframework.aop.support.DefaultPointcutAdvisor;
|
||||
import org.springframework.aop.support.DelegatingIntroductionInterceptor;
|
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.TimeStamped;
|
||||
import org.springframework.tests.aop.advice.CountingBeforeAdvice;
|
||||
import org.springframework.tests.aop.interceptor.NopInterceptor;
|
||||
@@ -369,6 +370,16 @@ public class ProxyFactoryTests {
|
||||
assertSame(proxy1, list.get(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInterceptorWithoutJoinpoint() {
|
||||
final TestBean target = new TestBean("tb");
|
||||
ITestBean proxy = ProxyFactory.getProxy(ITestBean.class, (MethodInterceptor) invocation -> {
|
||||
assertNull(invocation.getThis());
|
||||
return invocation.getMethod().invoke(target, invocation.getArguments());
|
||||
});
|
||||
assertEquals("tb", proxy.getName());
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class TimestampIntroductionInterceptor extends DelegatingIntroductionInterceptor
|
||||
|
||||
Reference in New Issue
Block a user