AspectJ Pointcuts的说明

<aop:config>
  <aop:aspect ref="audience">
    <aop:pointcut
        id="performance"
        expression="execution(* *.perform(..))" />
    <aop:before
        method="takeSeats"
        pointcut-ref="performance" />
    <aop:before
        method="turnOffCellPhones"
        pointcut-ref="performance" />
    <aop:after-returning
        method="applaud"
        pointcut-ref="performance" />
    <aop:after-throwing
        method="demandRefund"
        pointcut-ref="performance" />
  </aop:aspect>
</aop:config>
 

the <aop:pointcut> element defines a pointcut that can be referenced by all advices within the same <aop:aspect> element(在一个aspect中可以随处应用). But you can

also define pointcuts that can be used across multiple aspects by placing the

<aop:pointcut> elements within the scope of the <aop:config> element(跨越多个aspect).如下:

<aop:config>
<aop:pointcut
        id="performance"
        expression="execution(* *.perform(..))" />
  <aop:aspect ref="audience">
    <aop:before
        method="takeSeats"
        pointcut-ref="performance" />
    <aop:before
        method="turnOffCellPhones"
        pointcut-ref="performance" />
    <aop:after-returning
        method="applaud"
        pointcut-ref="performance" />
    <aop:after-throwing
        method="demandRefund"
        pointcut-ref="performance" />
  </aop:aspect>
</aop:config>
 

 

你可能感兴趣的:(AOP,performance)