zoukankan      html  css  js  c++  java
  • spring事务模板使用

    1.配置spring事务模板bean

        <!--spring 模板事务-->
        <bean id="transactionProxy" abstract="true"
            class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
            <property name="transactionManager" ref="TransactionManager" />
            <property name="transactionAttributes">
                <props>
                    *****
                </props>
            </property>
        </bean>

    2.事务服务bean的配置

      <bean id="xxxxDAO" class="com.xxxx.xxxxDAOImpl">
        <property name="sessionFactory" ref="sessionFactory" />
      </bean>
      <bean id="xxxxServiceTarget" class="com.xxxx.xxxxServiceImpl" parent="service">
        <property name="xxxxDAO" ref="xxxxDAO" />
      </bean>
      <bean id="xxxxService" parent="transactionProxy">
        <property name="target" ref="xxxxServiceTarget" />
      </bean>

    使用占位符配置bean的方法:

        <bean id="placeholderConfig"
            class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="locations">
                <list>
                    <value>
                        ***.properties
                    </value>
                    <value>
                       ***.properties
                    </value>
                </list>
            </property>
        </bean>

  • 相关阅读:
    面试题 08.02. 迷路的机器人(C++)
    URI和URL的区别
    Kali Linux自定义分辨率设置
    CentOS最小化安装后配置NAT网络模式
    CentOS7.5安装及最小安装后联网配置--联网配置
    CentOS7.5安装及最小安装后联网配置--系统安装
    基数排序
    归并排序
    堆排序
    简单选择排序
  • 原文地址:https://www.cnblogs.com/davidwang456/p/2871519.html
Copyright © 2011-2022 走看看