zoukankan      html  css  js  c++  java
  • Spring 声明式事务处理....XML

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    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-2.0.xsd">

    <bean id="datasource"
      class="org.apache.commons.dbcp.BasicDataSource">
      <property name="driverClassName"
       value="com.microsoft.sqlserver.jdbc.SQLServerDriver">
      </property>
      <property name="url"
       value="jdbc:sqlserver://localhost:1433;databaseName=hahademo">
      </property>
      <property name="username" value="sa"></property>
    </bean>
    <bean id="sessionFactory"
      class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
      <property name="dataSource">
       <ref bean="datasource"></ref>
      </property>
      <property name="hibernateProperties">
       <props>
        <prop key="hibernate.dialect">
         org.hibernate.dialect.SQLServerDialect
        </prop>
       </props>
      </property>
      <property name="mappingResources">
       <list>
        <value>po/Bank.hbm.xml</value>
       </list>
      </property>
    </bean>
    <bean name="/bank" class="action.BankAction">
      <property name="bankBiz">
       <ref bean="bankbiz" />
      </property>
    </bean>
    <bean id="bankbiz" class="biz.BankBizImpl">
      <property name="commonDao">
       <ref bean="commondao" />
      </property>
    </bean>
    <bean id="commondao" class="dao.CommonDaoImpl">
      <property name="sessionFactory">
       <ref bean="sessionFactory" />
      </property>
    </bean>
    <bean id="transactionManager"
      class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory">
       <ref bean="sessionFactory" />
      </property>
    </bean>
    <bean id="transactionInterceptor"
      class="org.springframework.transaction.interceptor.TransactionInterceptor">
      <property name="transactionManager">
       <ref bean="transactionManager" />
      </property>
      <property name="transactionAttributes">
       <props>
        <prop key="a">PROPAGATION_REQUIRED</prop>
       </props>
      </property>
    </bean>
    <bean id="transactionInterceptor1"
      class="org.springframework.transaction.interceptor.TransactionInterceptor">
      <property name="transactionManager">
       <ref bean="transactionManager" />
      </property>
      <property name="transactionAttributes">
       <props>
        <prop key="*">PROPAGATION_REQUIRED</prop>
       </props>
      </property>
    </bean>
    <bean
      class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
      <property name="beanNames">
       <list>
        <value>bankbiz</value>
       </list>
      </property>
      <property name="interceptorNames">
       <list>
        <value>transactionInterceptor</value>
        <value>transactionInterceptor1</value>
       </list>
      </property>
    </bean>
    <!--
      <bean id="biztransactionproxy"
      class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
      <property name="transactionManager">
      <ref bean="transactionManager" />
      </property>
      <property name="target">
      <ref bean="bankbiz" />
      </property>
      <property name="transactionAttributes">
      <props>
      <prop key="*">PROPAGATION_REQUIRED</prop>
      </props>
      </property>
      </bean>
    -->
    </beans>
  • 相关阅读:
    Java 创建过滤器 解析xml文件
    web页面隐藏鼠标
    dom4j微信接口开发
    php实现远程网络文件下载到服务器指定目录 阿星小栈
    laravel 框架给$request添加数据 阿星小栈
    Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command. 阿星小栈
    在vue项目中使用echarts 阿星小栈
    js 数组、时间、邮箱等处理方法 阿星小栈
    iview 在Table组件render 中使用Poptip组件 阿星小栈
    逐步解决动态添加样式导致的元素闪烁 阿星小栈
  • 原文地址:https://www.cnblogs.com/soundcode/p/1911890.html
Copyright © 2011-2022 走看看