Spring配置事物管理

 
        <property name="sessionFactory" ref="sessionFactory"></property>
    </bean>

    <aop:aspectj-autoproxy proxy-target-class="true"/>

    <tx:annotation-driven transaction-manager="transactionManager"/>

    <tx:advice id="txAdvice" transaction-manager="transactionManager">
        <tx:attributes>
            <tx:method name="save*" propagation="REQUIRED"/>
            <tx:method name="update*" propagation="REQUIRED"/>
            <tx:method name="remove*" propagation="REQUIRED"/>
            <tx:method name="delete*" propagation="REQUIRED"/>
            <tx:method name="*" read-only="true"/>
        </tx:attributes>
    </tx:advice>
    <aop:config>
        <aop:pointcut id="allMethod" expression="execution( * cn.les.ldbz.jframe.core.BaseServiceImpl.*(..))
                                    ||execution(* cn.les.ldbz.system.service.*.*(..))||execution(* cn.les.ldbz.ylbg.service.*.*(..))"/>
        <aop:advisor advice-ref="txAdvice" pointcut-ref="allMethod"/>
    </aop:config>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章