请教一下,为什么我定义一个环绕通知,会两次执行ProceedingJoinPoint.proceed方法
配置
<bean id="reviewAespect" class="com.aop.ReviewFilterAspect" autowire="byName"/>
<aop:config>
<aop:aspect ref="reviewAespect">
<aop:around pointcut="execution(* com.service.ReviewService.postReview(..))"
method="validateReview"/>
</aop:aspect>
</aop:config> public class ReviewFilterAspect { public Object validateReview(ProceedingJoinPoint joinPoint) throws Throwable{
Review review = (Review)joinPoint.getArgs()[0];
System.out.println(review.getIp());
Object obj= null;
obj = joinPoint.proceed(); return obj;
} 运行的时候拦截postReview方法,为什么会两次执行validateReview里面的代码
配置
<bean id="reviewAespect" class="com.aop.ReviewFilterAspect" autowire="byName"/>
<aop:config>
<aop:aspect ref="reviewAespect">
<aop:around pointcut="execution(* com.service.ReviewService.postReview(..))"
method="validateReview"/>
</aop:aspect>
</aop:config> public class ReviewFilterAspect { public Object validateReview(ProceedingJoinPoint joinPoint) throws Throwable{
Review review = (Review)joinPoint.getArgs()[0];
System.out.println(review.getIp());
Object obj= null;
obj = joinPoint.proceed(); return obj;
} 运行的时候拦截postReview方法,为什么会两次执行validateReview里面的代码
解决方案 »
- map的键被覆盖了!
- 关于java反射的一道题
- FCKeditor文本框的设置?怎么设置时文本框一开始机出现滚动条,而不是超过一定长度后出现而导致工具栏被抬高??谢谢
- struts2如何关闭数据库连接
- JSF 的<h:datatable>的用法求救
- Spring + Hibernate + Struts批量更新
- 急!JBuilder 9的工程编译后怎么会有3137个错误?!晕
- 用java实现迷宫求解问题
- 为什么.do不能执行?
- super() 感觉很多都没有意义但是为什么要这么写呢??~
- 关于AXIS Server.generalException错误
- JavaMail的Transport.send(msg)或Transport.connect
<aop:around method="doMehtod" pointcut-ref="myPointCut" /> 环绕二次
<aop:after pointcut-ref="myPointCut" method="doAfter" /> 方法后一次