第三章 AOP 编程选择

时间:2023-03-09 08:01:52
第三章 AOP 编程选择

Spring为我们开发者提供了多种AOP的编程方式。我们该如何选择呢?

  1. 如果项目采用的是JDK5.0以上版本,我们可以选择@AspectJ的方式。这是第一选择。

    http://blog.****.net/p_3er/article/details/9268637

  2. 如果使用的是低版本的JDK,那么可以考虑使用<aop:aspect>,也就是Schema的方式。

    http://blog.****.net/p_3er/article/details/9269407

  3. 如果需要一些特殊的切面需要,如基于ControlFlowPointcut的流程切面,那么我们只能使用基于API的Advisor方式(也就是通过spring给我提供的接口与类)来进行构建。

    http://blog.****.net/p_3er/article/details/9239925

    http://blog.****.net/p_3er/article/details/9250117

  4. 在做基于Spring的事务管理的时候,使用<aop:aspect>的方式更加方便。

    http://blog.****.net/p_3er/article/details/9269407