声明式事务xml Spring
!--JDBC事务管理器-->
<bean id="tansactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<constructor-arg ref="dataSource"></constructor-arg>
</bean>
<!--配置事务通知-->
<tx:advice id="transactionInterceptor" transaction-manager="tansactionManager">
<tx:attributes>
<tx:method name="*"/>
</tx:attributes>
</tx:advice>
<!--配置切面-->
<aop:config>
<!--配置切点-->
<aop:pointcut id="serviceMethod" expression="execution(* party.infoo.spring.TX.service.*.*(..))"></aop:pointcut>
<aop:advisor advice-ref="transactionInterceptor" pointcut-ref="serviceMethod"></aop:advisor>
</aop:config>
<!--JDBC事务管理器--> <bean id="tansactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <constructor-arg ref="dataSource"></constructor-arg> </bean> <!--配置事务通知--> <tx:advice id="transactionInterceptor" transaction-manager="tansactionManager"> <tx:attributes> <tx:method name="*"/> </tx:attributes> </tx:advice> <!--配置切面--> <aop:config> <!--配置切点--> <aop:pointcut id="serviceMethod" expression="execution(* party.infoo.spring.TX.service.*.*(..))"></aop:pointcut> <aop:advisor advice-ref="transactionInterceptor" pointcut-ref="serviceMethod"></aop:advisor> </aop:config>
By Ginfoo