您的位置:首页 > 其它

快速搭建客户服务管理平台

2010-05-11 13:05 477 查看
配置文件:

<!-- 配置事务管理器 -->
 <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">  
    <property name="dataSource" ref="dataSource"/>  
  </bean> 
  <!-- 配置业务bean -->

    <!-- 使用XML来使用事务管理--> 
<aop:config> 
    <!-- 配置一个切面,和需要拦截的类和方法 -->  
    <aop:pointcut id="transactionPointcut" expression="execution(* com.persia.service..*.*(..))"/> 
    <aop:advisor advice-ref="txAdvice" pointcut-ref="transactionPointcut"/> 
</aop:config>
<!-- 配置一个事务通知 -->   
<tx:advice id="txAdvice" transaction-manager="txManager"> 
      <tx:attributes>
      <!-- 方法以get开头的,不使用事务 -->
        <tx:method name="get*" read-only="true" propagation="NOT_SUPPORTED"/>
      <!-- 其他方法以默认事务进行 -->
        <tx:method name="*"/> 
      </tx:attributes> 
</tx:advice> 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: