Spring XML配置事务管理

以下是XML配置事务管理的核心代码,其它配置参考 http://oracle-api.iteye.com/admin/blogs/2077242


	<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  	   <property name="dataSource" ref="dataSource"/>
    </bean>

	<aop:config>
	  	<aop:pointcut id="transactionPointcut" expression="execution(* cn.itcast.service..*.*(..))"/>
	  	<aop:advisor advice-ref="txAdvice" pointcut-ref="transactionPointcut"/>
	</aop:config> 
	<tx:advice id="txAdvice" transaction-manager="txManager">
		  <tx:attributes>
		    <tx:method name="get*" read-only="true" propagation="NOT_SUPPORTED"/>
		    <tx:method name="*"/> <!--其它方法采用默认事务管理配置 -->
		  </tx:attributes>
	</tx:advice>

猜你喜欢

转载自oracle-api.iteye.com/blog/2078023