<bean id="audience" class="first.Audience"/>
<aop:config>
<aop:aspect ref="audience">
<aop:pointcut id="performance" expression=
"execution(* first.Play.play(..))"/>
<aop:before pointcut-ref="performance" method="takeSeats"/>
<aop:before pointcut-ref="performance" method="turnOffCellPhones"/>
<aop:after-returning pointcut-ref="performance" method="applaud"/>
<aop:after-throwing pointcut-ref="performance" method="demandRefund"/>
</aop:aspect>
</aop:config>
<bean id="around" class="first.AOPAround"/>
<aop:config>
<aop:aspect ref="audience">
<aop:pointcut id="performance11" expression=
"execution(* first.Play.play(..))"/>
<aop:around pointcut-ref="performance11" method="watch()"/>
</aop:aspect>
</aop:config>
</beans>

解决方案 »

  1.   

    当我不用aop:around时能运行,但用时出现上述异常,找了很久都没找到解决方法
      

  2.   

    Auience中的方法 public void watch(ProceedingJoinPoint joinpoint){
    try{
    System.out.println("Now Linkin park will sing a song.....");
    long start=System.currentTimeMillis();
    joinpoint.proceed();
    long end=System.currentTimeMillis();
    System.out.println("joinpoint.proceed() tock "+(end-start));
    }catch(Throwable t){
    System.out.println("Boo! We want our money back!");
    }
    }