spring的aop事务配置模板

<!-- 配置事务管理器 -->
	<bean  name="transactionManager"
	class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource"/>
	</bean>
	
	<!-- 配置事务通知 -->
	<tx:advice transaction-manager="transactionManager" id="txAdvice">
		<tx:attributes>
			<tx:method name="transfer" isolation="REPEATABLE_READ" propagation="REQUIRED" read-only="false"/>
		</tx:attributes>
	</tx:advice>
	
	<!-- 配置织入 weaving -->
	<aop:config>
		<aop:pointcut expression="execution(* com.iteason.service.*ServiceImp.*(..))" id="txPc"/>
		<aop:advisor advice-ref="txAdvice" pointcut-ref="txPc"/>
	</aop:config>

猜你喜欢

转载自blog.csdn.net/pbrlovejava/article/details/80445741