开发者社区 问答 正文

Spring的AOP与AspectJ是什么关系?

在实现AOP编程时,有用的动态代理,有用的cglib,然后有提到了AspectJ。

请问AspectJ与前二者是什么关系?

一般在实际开发时,推荐使用哪种?

展开
收起
a123456678 2016-03-18 13:44:13 4191 分享 版权
1 条回答
写回答
取消 提交回答
  • <!-- Aspect -->
    <bean id="logAspect" class="com.mkyong.aspect.LoggingAspect" />
      
    <aop:config>
      
      <aop:aspect id="aspectLoggging" ref="logAspect" >
      
         <!-- @After -->
         <aop:pointcut id="pointCutAfter"
        expression="execution(* com.mkyong.customer.bo.CustomerBo.addCustomer(..))" />
      
         <aop:after method="logAfter" pointcut-ref="pointCutAfter" />
      
      </aop:aspect>
      
    </aop:config>
    2019-07-17 19:06:29
    赞同 展开评论