隨筆 - 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)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 玛曲县| 馆陶县| 广饶县| 平陆县| 舒兰市| 铜山县| 阿克苏市| 内江市| 新蔡县| 英吉沙县| 九江县| 密云县| 嘉兴市| 垫江县| 五家渠市| 新巴尔虎左旗| 门头沟区| 孟津县| 连州市| 宣威市| 延安市| 班戈县| 彭水| 兴海县| 黄陵县| 普宁市| 陆丰市| 仪征市| 五寨县| 化隆| 宣汉县| 武平县| 井陉县| 长顺县| 桦甸市| 高安市| 清水县| 玉环县| 昌平区| 宝应县| 茌平县|