zoukankan      html  css  js  c++  java
  • 我将Spring配置文件放置在applicationContextcommon.xml中

    我将Spring配置文件放置在applicationContext-common.xml中

    Xml代码  收藏代码
    1. <?xml version="1.0" encoding="UTF-8"?>  
    2.   
    3. <beans xmlns="http://www.springframework.org/schema/beans"  
    4.          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    5.          xmlns:aop="http://www.springframework.org/schema/aop"  
    6.          xmlns:tx="http://www.springframework.org/schema/tx"  
    7.          xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd  
    8.            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd  
    9.            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">  
    10.       
    11.        <!-- 配置sessionFactory -->  
    12.     <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">  
    13.         <property name="configLocation">  
    14.             <value>classpath:hibernate.cfg.xml</value>  
    15.         </property>  
    16.     </bean>     
    17.       
    18.     <!-- 配置事务管理器 -->    
    19.     <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">  
    20.         <property name="sessionFactory">  
    21.             <ref local="sessionFactory"/>  
    22.         </property>  
    23.     </bean>  
    24.       
    25.     <!-- 配置事务特性 -->         
    26.     <tx:advice id="txAdvice" transaction-manager="transactionManager">  
    27.         <tx:attributes>  
    28.             <tx:method name="*" propagation="REQUIRED"/>  
    29.               <!--  
    30.                <tx:method name="add*" propagation="REQUIRED"/>                
    31.             <tx:method name="del*" propagation="REQUIRED"/>  
    32.             <tx:method name="update*" propagation="REQUIRED"/>  
    33.             <tx:method name="deploy*" propagation="REQUIRED"/>  
    34.             <tx:method name="submit*" propagation="REQUIRED"/>  
    35.             <tx:method name="*" read-only="true"/>  
    36.             -->  
    37.         </tx:attributes>  
    38.     </tx:advice>  
    39.       
    40.     <!-- 配置那些类的方法进行事务管理 -->  
    41.     <aop:config>  
    42.         <aop:pointcut id="allManagerMethod" expression="execution (* com.gdf.crm.manager.*.*(..))"/>  
    43.         <aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod"/>  
    44.     </aop:config>      
    45.         
    46. </beans>  
    你给了我眼睛,却不给我光明。
  • 相关阅读:
    python之__new__方法
    python之类也是一个对象
    python之面向对象中的多态
    python之多继承中的一些问题
    python之子类继承父类时进行初始化的一些问题
    Java深度历险(四)——Java垃圾回收机制与引用类型
    Java深度历险(三)——Java线程​:基本概念、可见性与同步
    Java深度历险(二)——Java类的加载、链接和初始化
    Java深度历险(一)——Java字节代码的操纵
    程序员面试什么最重要?
  • 原文地址:https://www.cnblogs.com/wwb0111/p/3098943.html
Copyright © 2011-2022 走看看