美文网首页
事务管理器

事务管理器

作者: 小竹猫 | 来源:发表于2019-01-02 21:09 被阅读0次
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">

    <!-- 事务管理器 -->
    <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="save*" propagation="REQUIRED" />
            <tx:method name="insert*" propagation="REQUIRED" />
            <tx:method name="delete*" propagation="REQUIRED" />
            <tx:method name="update*" propagation="REQUIRED" />
            <tx:method name="find*" propagation="SUPPORTS" read-only="true" />
            <tx:method name="get*" propagation="SUPPORTS" read-only="true" />
            <tx:method name="query*" propagation="SUPPORTS" read-only="true" />
        </tx:attributes>
    </tx:advice>

    <!-- 切面 -->
    <aop:config>
        <aop:advisor advice-ref="txAdvice"
            pointcut="execution(*com.igeek.ssm.service.*.*(..))" />
    </aop:config>

</beans>

相关文章

  • Spring事务管理

    一、事务管理器事务管理器.png 二、事务的传播规则 Spring 在 TransactionDefinition...

  • spring事务

    1、spring事务管理器PlatformTransactionManager 1.1、没有spring事务管理器...

  • spring 事务管理

    1、PlatformTransactionManager 事务管理器spring要管理事务必须使用事务管理器。进行...

  • Spring的事务管理

    一.Spring事务管理API介绍 1.事务管理器事务管理器是PlatformTransactionManager...

  • 一文搞懂Spring事务

    配置注解版事务 事务管理器 事务管理器的接口是PlatformTransactionManager,其中定义了三个...

  • spring-事务

    一 事务信息配置 配置事务管理器及数据库连接池 配置事务注解@Transactional处理,注入事务管理器

  • Spring事务

    容器事务 Spring事务核心接口 JDBC事务管理器(DataSourceTransactionManager)...

  • 编程事务-基于transactionTemplate模板实现

    编程事务 编程事务-实现方式 PlatformTransactionManager(平台事务管理器) Transa...

  • JTA事务管理器-Atomikos 还是 Bitronix?(译

    JTA事务管理器-Atomikos 还是 Bitronix? 最近一个服务器端应用需要选择合适的事务管理器,该事务...

  • spring使用

    一、事务管理 PlatformTransactionManager事务管理器 TransactionDefinit...

网友评论

      本文标题:事务管理器

      本文链接:https://www.haomeiwen.com/subject/jlvtrqtx.html