大時代

          大時代--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>

          主站蜘蛛池模板: 昭通市| 巴南区| 绥化市| 吴旗县| 手机| 谢通门县| 海伦市| 建瓯市| 黄浦区| 湘潭县| 涿鹿县| 无为县| 牟定县| 游戏| 柳河县| 长岛县| 德庆县| 通江县| 太康县| 象州县| 陕西省| 武宁县| 和龙市| 孟连| 涞源县| 子长县| 尉氏县| 大城县| 民勤县| 雷州市| 巢湖市| 贵州省| 霍林郭勒市| 开封县| 永昌县| 任丘市| 射阳县| 即墨市| 化州市| 新蔡县| 长武县|