ProxyFactory weaver = new ProxyFactory();
weaver.setProxyTargetClass(false);
weaver.setTarget(new InterceptableTwo());
AspectJExpressionPointcut p = new AspectJExpressionPointcut(); p.setExpression("this(org.darrenstudio.books.unvei lspring.aop.pointcut.aspectj.InterceptableTwo)");
DefaultPointcutAdvisor aspect = new DefaultPointcutAdvisor(p,new AjAfterAdvice() );
weaver.addAdvisor(aspect);
Interceptable proxy = (Interceptable)weaver.getProxy();
System.out.println(proxy.isInterceptable());
as to the proxy pattern , although the proxy object and the target implement the same interface(Interceptable interface here), but it does not mean the expression "proxy instanceof target" is true, right?
but the code above still matches, who can tell me why?![]()


Reply With Quote
