zoukankan      html  css  js  c++  java
  • Spring事务配置

    <!-- 配置事务管理器 -->
    <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
            <property name="dataSource" ref="dataSource"/>
    </bean>
     
    <!-- 配置事务管理advice -->
    <tx:advice id="txAdvice" transaction-manager="txManager">
      <tx:attributes>
      <tx:method name="get*" 	read-only="true" />
      <tx:method name="find*"     read-only="true" />
      <tx:method name="select*"  	read-only="true"/>
      <tx:method name="query*"  	read-only="true"/>
      <tx:method name="search*"  	read-only="true"/>
      <tx:method name="count*"  	read-only="true" />
      <tx:method name="*"  propagation="SUPPORTS"  rollback-for="java.lang.Exception"/>
      </tx:attributes>
    </tx:advice>
    

      

      

    <!-- 配置切入点切面 -->
    <aop:config>
            <aop:pointcut id="txPointcut" expression="(execution(* com.avcon.*.*.service..*.*(..))) or (execution(* com.avcon.*.*.controller..*.*(..)))" />
            <aop:advisor pointcut-ref="txPointcut" advice-ref="txAdvice" />
         <!-- 增强代码 -->
          <aop:aspect order="-2147483648" ref="dynamicDataSourceAop">
               <aop:around pointcut-ref="txPointcut" method="doAroundMethod"/>
               <!-- 
               <aop:after-returning method=""/>
               <aop:before method=""/>
               <aop:after-throwing method=""/>
               <aop:after method=""/>
               -->
            </aop:aspect>
    </aop:config>
    

      

      

  • 相关阅读:
    pyQt5新手教程 (二)开始你的旅程-编写
    未来写作
    电脑使用问题
    cad学习问题
    chm制作
    github学习之路
    python解决实际问题
    英语学习
    经济学
    通过playgrounds程序学习swift语言及思想
  • 原文地址:https://www.cnblogs.com/zhoucx66/p/8967921.html
Copyright © 2011-2022 走看看