Spring 配置文件--- 事务处理

事务的处理在service层。

<!-- - - - - - - spring Transaction Manager - - - - - - - -->
	<bean id="transactionManager"
		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource" />
	</bean>
	<!-- - - - - - - spring Transaction Attribute - - - - - - - -->
	<tx:advice id="transactionAdvice"
		transaction-manager="transactionManager">
		<tx:attributes>
			<tx:method name = "*" 
						isolation = "READ_COMMITTED"
						propagation = "REQUIRED"
						rollback-for = "java.lang.Throwable" />
		</tx:attributes>
	</tx:advice>
	
	<!--******    weave  *********-->
	<aop:config>
		<aop:pointcut id="serviceMethod"
			expression="execution(* com.iss.service.impl.*.*(..))" />
		<aop:advisor advice-ref="transactionAdvice" pointcut-ref="serviceMethod" />
	</aop:config> 
 

猜你喜欢

转载自xurichusheng.iteye.com/blog/1066086
今日推荐