• 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>
  • 相关阅读:
    第五周作业
    2019春第四周作业编程总结
    2019春第四周作业
    2019春第二周作业编程总结
    2019春第一周作业编程总结
    自我认识
    对我影响最大的三位老师
    C语言I博客作业04
    C语言I博客作业03
    C语言I博客作业02
  • 原文地址:https://www.cnblogs.com/soundcode/p/1911890.html
Copyright © 2020-2023  润新知