跟老师演示结果有点出入?问题出在哪儿呢?
方法拦截类代码:
System.out.println("AopMethodInterceptor : invoke 1 "+ invocation.getMethod().getName()+
" "+invocation.getStaticPart().getClass().getName());
Object object = invocation.proceed();
System.out.println("AopMethodInterceptor : invoke 2 "+ object);
return object;
执行结果:
log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment).
log4j:WARN Please initialize the log4j system properly.
AopBeforeAdvice : Method save org.aop.api.BizLogicImpl
AopMethodInterceptor : invoke 1 save java.lang.reflect.Method
BizLogicImpl:save success
AopAfterReturningAdvice:afterReturning()save org.aop.api.BizLogicImpl BizLogicImpl:save()
AopMethodInterceptor : invoke 2 BizLogicImpl:save()
相关分类