我在配置Spring的时候,想配置两个切面
<aop:config>
   <aop:pointcut id="allManageMethod"
              expression="execution(* com.lhq.prj.bms.service.impl.*.*(..))"/>
   <aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod"/>
</aop:config>
这是其中的一个切面
我还想配置另一个切面为 * com.czccb.bmsh.service.impl.*.*(..) 该怎么配置啊,是不是就像下面这样啊
<aop:config>
   <aop:pointcut id="allManageMethod1"
              expression="execution(* com.lhq.prj.bms.service.impl.*.*(..))"/>
   <aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod1"/>
   <aop:pointcut id="allManageMethod2"
              expression="execution(* com.czccb.bmsh.service.impl.*.*(..)"/>
   <aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod2"/>
</aop:config>这样行不行啊,还是需要别的配置方法啊,大家帮帮我啊,谢谢了

解决方案 »

  1.   

    你上面的配置只是顺序的问题!其实你要是稍微看一下提示的话,你就明白了
    <aop:config>
      <aop:pointcut id="allManageMethod1"
                  expression="execution(* com.lhq.prj.bms.service.impl.*.*(..))"/>
      <aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod1"/>
      <aop:pointcut id="allManageMethod2"
                  expression="execution(* com.czccb.bmsh.service.impl.*.*(..)"/>
      <aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod2"/>
    </aop:config> 
    修改成
    <aop:config>
      <aop:pointcut id="allManageMethod1"
                  expression="execution(* com.lhq.prj.bms.service.impl.*.*(..))"/>
      <aop:pointcut id="allManageMethod2"
                  expression="execution(* com.czccb.bmsh.service.impl.*.*(..)"/>
      <aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod1"/>  
      <aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod2"/>
    </aop:config> 你先这样试试看吧!