Fork me on GitHub

spring简单事务管理器

  事务管理器

  <!-- Transaction manager for a single JDBC DataSource -->
  <bean id="transactionManager_xyhoa"
    class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource_xyhoa" />
  </bean>
  <tx:advice id="xyhoaTxAdvice" transaction-manager="transactionManager_xyhoa">
    <tx:attributes>
      <tx:method name="insert*" propagation="REQUIRED" rollback-for="Exception"/>
      <tx:method name="update*" propagation="REQUIRED" rollback-for="Exception"/>
      <tx:method name="delete*" propagation="REQUIRED" rollback-for="Exception"/>
      <tx:method name="select*" read-only="true"/>
    </tx:attributes>
  </tx:advice>/*</tx:advice>该标签是指将上面的bean的manager为transactionManager_xyhoa,然后再将id为xyhoaTx1去管理这个bean。
  <aop:config proxy-target-class="true">
    <aop:pointcut id="xyhoaTx1" expression="execution(* com.xyh.xyhoa.service*..*.*(..))" />
    <aop:advisor advice-ref="xyhoaTxAdvice" pointcut-ref="xyhoaTx1" order="1" />
  </aop:config>

posted on 2014-12-04 16:49  mrdoor  阅读(253)  评论(0编辑  收藏  举报