spring使用xml进行声明式事务管理



    

         id="serviceOperation"
                expression="execution(* x.y.service..Service.(..))"/>

         pointcut-ref="serviceOperation" advice-ref="txAdvice"/>

    

    
     id="fooService" class="x.y.service.DefaultFooService"/>
     id="barService" class="x.y.service.extras.SimpleBarService"/>

    
     id="anotherService" class="org.xyz.SomeService"/> 
     id="barManager" class="x.y.service.SimpleBarManager"/> 

     id="txAdvice">
        
             name="get*" read-only="true"/>
             name="*"/>
        
    



readonly 为true事务里面必须没有insert update等

    

         id="serviceOperation"
                expression="execution(* x.y.service..Service.(..))"/>

         pointcut-ref="serviceOperation" advice-ref="txAdvice"/>

    

    
     id="fooService" class="x.y.service.DefaultFooService"/>
     id="barService" class="x.y.service.extras.SimpleBarService"/>

    
     id="anotherService" class="org.xyz.SomeService"/> 
     id="barManager" class="x.y.service.SimpleBarManager"/> 

     id="txAdvice">
        
             name="get*" read-only="true"/>
             name="*"/>
        
    

你可能感兴趣的:(Spring)