声明式事务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>

 

posted @ 2017-02-19 02:52  Lucky、Dog  阅读(198)  评论(0编辑  收藏  举报