大時代

          大時代--java

          BlogJava 聯系 聚合 管理
            0 Posts :: 6 Stories :: 0 Comments :: 0 Trackbacks
          applicationContext.xml配置

          <?xml version="1.0" encoding="UTF-8"?>

          <!--
            - Application context definition for JPetStore's business layer.
            - Contains bean references to the transaction manager and to the DAOs in
            - dataAccessContext-local/jta.xml (see web.xml's "contextConfigLocation").
            -->
          <beans xmlns="      xmlns:xsi="      xmlns:aop="      xmlns:tx="      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
                     http://www.springframework.org/schema/tx  <!--配置sessionFactory  -->
           <!--讀取數據庫配置文件  -->
           <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
            <property name="configLocation">
             <value>classpath:hibernate.cfg.xml</value>
            </property>
           </bean>
           
           <!--配置事務  -->
           <!-- 指定參與事務的數據庫 -->
           <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
            <property name="sessionFactory" ref="sessionFactory"/>
           </bean>
           
           <!--配置事務傳播特性  -->
           <tx:advice id="txAdvice" transaction-manager="transactionManager">
            <tx:attributes>
             <tx:method name="add*" propagation="REQUIRED"/>
             <tx:method name="delete*" propagation="REQUIRED"/>
             <tx:method name="modify*" propagation="REQUIRED"/>
             <tx:method name="*" read-only="true"/>
            </tx:attributes>
           </tx:advice>
           
           <!--配置參與事務的方法  --> 
           <aop:config>
            <aop:pointcut id="allMothod" expression="* com.bjsxt.*..(..)"/>
            <aop:advisor pointcut-ref="allMothod" advice-ref="txAdvice"/>
           </aop:config>
           
           <!--配置action.java 文件-->
          <bean name="/login" class="com.bjsxt.test.actions.LoginAction" scope="prototype">
            <property name="userManger" ref="userManager"/>
           </bean>

          <!---普通bean配置-->
          <bean id="userManager" class="com.bjsxt.test.manager.UserManagerImpl"></bean>

          </beans>

          主站蜘蛛池模板: 东乡县| 和顺县| 兴义市| 进贤县| 阿拉善右旗| 开江县| 灵璧县| 浠水县| 嘉峪关市| 永清县| 藁城市| 门源| 新和县| 宁蒗| 通州区| 墨竹工卡县| 扶沟县| 团风县| 平遥县| 吐鲁番市| 华容县| 黔东| 广宁县| 股票| 原阳县| 连南| 永泰县| 盐边县| 土默特左旗| 佛坪县| 图们市| 万源市| 阿克陶县| 齐河县| 昭通市| 江达县| 文山县| 忻城县| 葵青区| 格尔木市| 黄龙县|