spring对AOP的支持(使用Spring的配置文件来演示)
将切面,切入点和通知定义在spring文件中:
<aop:config>
<aop:pointcut id="allAddMethod" expression="execution(* add*(..))"/>
<aop:aspect id="securityAspect" ref="mySecurityManager">
<aop:before pointcut-ref="allAddMethod" method="checkSecurity"/>
</aop:aspect>
</aop:config>
* 通过<aop:piontcut> 标签定义切入点
* 通过<aop:aspect> 标签定义切面
* 可以在<aop:aspect>内部定义通知对应的方法和对应的切入点