spring配置基于xml的声明式事务

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

    
    

    <tx:advice id="txAdvice" transaction-manager="transactionManager">
        <tx:attributes>
            
            <tx:method name="*" propagation="REQUIRED" read-only="false"/>
            <tx:method name="get*" read-only="true" />
            <tx:method name="query*" read-only="true" />
            <tx:method name="find*" read-only="true" />
            
            <tx:method name="requiresNew*" propagation="REQUIRES_NEW"/>
            
            <tx:method name="notSupported*" propagation="NOT_SUPPORTED"/>
        tx:attributes>
    tx:advice>

    <aop:config>
        <aop:advisor id="tx" advice-ref="txAdvice" pointcut="execution(* com.alphajuns.service.impl.*.*(..))"/>
        
        
        
        
    aop:config>

 

你可能感兴趣的:(spring配置基于xml的声明式事务)