aop:aspect 面向切面编程是横向抽取重复的功能, 通过before, after等来表示增强功能, 并增强到切入点.
aop:advisor 声明式事务是通过事务管理器, 来控制切入点自动回滚或提交.
两者可以同时配置, 也可以各自配置, 互不干涉.
<!--基于AspectJ xml实现声明式事务-->
<aop:config>
<!--切入点表达式-->
<aop:pointcut id="txPointcut" expression="execution(* com.itheima.service.*.*(..))"/>
<!--事务增强-->
<aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut"/>
<!--aop编程, 横向抽取-->
<aop:aspect ref="logging">
<aop:before method="beforeTest" pointcut-ref="txPointcut"/>
</aop:aspect>
</aop:config>
<!--开启aop注解编程 -->
<aop:aspectj-autoproxy/>
<!--开启声明式事务注解-->
<tx:annotation-driven transaction-manager="transactionManager"></tx:annotation-driven>