Spring 声明式事务的配置方式(五)

来源:互联网 发布:数据中心网络建设方案 编辑:程序博客网 时间:2024/05/29 03:40

利用aop:config切入配置事务代理

 

<!-- 事务通知 -->

 

<tx:advice id="txAdvice"

               transaction-manager="transactionManager">

       <!—配置事务传递属性-->

        <tx:attributes>

           <tx:method name="get*" propagation="SUPPORTS"/>

           <tx:method name="find*" propagation="SUPPORTS"/>

           <tx:method name="do*" propagation="SUPPORTS"/>

           <tx:method name="reg*" propagation="REQUIRED"/>

           <tx:method name="modify*" propagation="REQUIRED"/>

           <tx:method name="valid*" propagation="SUPPORTS"/>

           <tx:method name="process*" propagation="REQUIRED"/>

        </tx:attributes>

</tx:advice>

 

<aop:config>

        <!--切入点-->

        <aop:pointcut id="bizMethods"

               expression="execution(* org.companyname.myprj.services.*.*(..))"/>

        <aop:advisor advice-ref="txAdvice" pointcut-ref="bizMethods"/>

</aop:config> 

 

 

 

原创粉丝点击