隨筆 - 16  文章 - 0  trackbacks - 0
          <2012年3月>
          26272829123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          常用鏈接

          留言簿

          隨筆檔案

          友情鏈接

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          <beans xmlns=" xmlns:xsi="http://www.springframework.org/schema/beans
                     http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                     http://www.springframework.org/schema/context
                     http://www.springframework.org/schema/context/spring-context-3.1.xsd        
                     http://www.springframework.org/schema/aop
                     http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
                     http://www.springframework.org/schema/tx
                    

           <!-- 攔截配置 -->
           <tx:advice id="txAdvice" transaction-manager="transactionManager">
                <tx:attributes>
                      <!--說明事務類別 read-only表示不支持事務,propagation的事務類別與EJB保持一致-->
                     <tx:method name="find*" read-only="true" />
                     <tx:method name="get*" read-only="true" />
                     <tx:method name="load*" read-only="true" />
                     <tx:method name="save*" propagation="REQUIRED" />
                     <tx:method name="insert*" propagation="REQUIRED" />
                     <tx:method name="update*" propagation="REQUIRED" />
                     <tx:method name="delete*" propagation="REQUIRED" />
                     <tx:method name="*" propagation="REQUIRED" />
                </tx:attributes>
           </tx:advice>

           <!-- 切入點 -->
           <aop:config>
                <!-- Dao層事務 說明你要攔截那些包下面的類的方法-->
                <aop:advisor id="daoTx" advice-ref="txAdvice"  pointcut="execution(* *..dao.impl.*.*(..))" order="0" />
                <!-- service層事務 -->
                <aop:advisor id="serviceTx" advice-ref="txAdvice"  pointcut="execution(* *..service.impl.*.*(..))" order="1" />
           </aop:config>

           <!-- Enable @Transactional support -->
           <tx:annotation-driven />
           
           <!-- 事務管理 -->
           <bean id="transactionManager"  class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
                <property name="dataSource" ref="dataSource" />
           </bean>
          。。。下面是具體的dataSource配置
          或下載附件
          http://www.aygfsteel.com/Files/yiqi/application-resources.rar

          posted on 2012-03-13 10:56 民工二代 閱讀(310) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 抚顺县| 通许县| 丰原市| 阳谷县| 谢通门县| 巧家县| 诸城市| 康保县| 都安| 东乡县| 平和县| 万源市| 太谷县| 桂阳县| 湘阴县| 泽普县| 道真| 同德县| 连山| 大理市| 富宁县| 三原县| 日照市| 原阳县| 南平市| 堆龙德庆县| 三门峡市| 东方市| 九江市| 榆社县| 应城市| 旬阳县| 长葛市| 北川| 无为县| 炎陵县| 庄河市| 朝阳县| 沙坪坝区| 定结县| 多伦县|