【结论】

    在多个切面类的“切入点相同”并且每个切面都“没有定义order属性”的情况下,则切面类(中的通知)的执行顺序与该切面类在<aop:config>元素中“声明的顺序”相关,即先声明的切面类先执行,后声明的切面类后执行。 

【代码示例】

 1 <aop:config>
 2     <!-- 用户自定义的切面01,用于不同切面类执行顺序的测试 -->        
 3     <aop:aspect id="myMethod01Aspect" ref="myMethod01Bean">
 4         <aop:before method="myBeforeMethod01"  pointcut="execution(* com.zjrodger.bakdata.service..*.*(..))"/>
 5     </aop:aspect>                                
 6 
 7     <!-- 用户自定义的切面02,用于不同切面类执行顺序的测试。 -->    
 8     <aop:aspect id="myMethod02Aspect" ref=" myMethod02Bean">                
 9          <aop:before method=" myBeforeMethod02"  pointcut="execution(* com.zjrodger.bakdata.service..*.*(..))"/>    
10     </aop:aspect>    
11 </aop:config>
不同切面类配置示例

相关文章:

  • 2022-01-07
  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
  • 2021-09-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案