搭建SSH框架的时候的applicationContext.xml配置文件

来源:互联网 发布:nba官方科比生涯数据 编辑:程序博客网 时间:2024/05/16 23:36

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:aop="http://www.springframework.org/schema/aop"
 xmlns:tx="http://www.springframework.org/schema/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/tx
  http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
  http://www.springframework.org/schema/aop
  http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
 ">

 <!-- 声明式事务 -->
 <bean id="myHibTransactionManager"
  class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  <property name="sessionFactory" ref="sessionFactory"></property>
 </bean>
 <tx:advice id="txAdvice"
  transaction-manager="myHibTransactionManager">
  <tx:attributes>
   <tx:method name="add*" propagation="REQUIRED" />
   <tx:method name="del*" propagation="REQUIRED" />
   <tx:method name="update*" propagation="REQUIRED" />
   <tx:method name="do*" propagation="REQUIRED" />
   <tx:method name="*" propagation="REQUIRED" read-only="true" />
  </tx:attributes>
 </tx:advice>
 <aop:config>
  <aop:pointcut id="bizMethods"
   expression="execution(* org.gsxzy.hr.biz.*.*(..))" />
  <!-- 指定会用到事务的业务类的包的路径 -->
  <aop:advisor advice-ref="txAdvice" pointcut-ref="bizMethods" />
 </aop:config>

 


 <bean id="dataSource"
  class="org.apache.commons.dbcp.BasicDataSource">
  <property name="driverClassName"
   value="com.microsoft.jdbc.sqlserver.SQLServerDriver">
  </property>
  <property name="url"
   value="jdbc:microsoft:sqlserver://localhost:1433">
  </property>
  <property name="username" value="sa"></property>
 </bean>
 <bean id="sessionFactory"
  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="dataSource">
   <ref bean="dataSource" />
  </property>
  <property name="hibernateProperties">
   <props>
    <prop key="hibernate.dialect">
     org.hibernate.dialect.SQLServerDialect
    </prop>
   </props>
  </property>
  <property name="mappingResources">
   <list>
    <value>org/gsxzy/hr/entity/TestTbl.hbm.xml</value>
    <value>org/gsxzy/hr/entity/Users.hbm.xml</value>
    <value>
     org/gsxzy/hr/entity/EngageMajorRelease.hbm.xml
    </value>
    <value>org/gsxzy/hr/entity/ConfigFile.hbm.xml</value>
    <value>
     org/gsxzy/hr/entity/ConfigFileSecondKind.hbm.xml
    </value>
    <value>
     org/gsxzy/hr/entity/ConfigFileThirdKind.hbm.xml
    </value>
    <value>
     org/gsxzy/hr/entity/EngageSubjects.hbm.xml
    </value>
    <value>
     org/gsxzy/hr/entity/EngageExamDetails.hbm.xml
    </value>
    <value>org/gsxzy/hr/entity/EngageAnswer.hbm.xml</value>
    <value>
     org/gsxzy/hr/entity/ConfigMajorKind.hbm.xml
    </value>
    <value>org/gsxzy/hr/entity/ConfigMajor.hbm.xml</value>
    <value>
     org/gsxzy/hr/entity/ConfigQuestionFirstKind.hbm.xml
    </value>
    <value>
     org/gsxzy/hr/entity/ConfigQuestionSecondKind.hbm.xml
    </value>
    <value>org/gsxzy/hr/entity/EngageResume.hbm.xml</value>
   </list>
  </property>
 </bean>
 <bean id="TestTblDAO" class="org.gsxzy.hr.dao.TestTblDAO">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
 </bean>
 <bean id="usersdao" class="org.gsxzy.hr.dao.impl.IUsersDAO">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
 </bean>
 <bean id="engagedao" class="org.gsxzy.hr.dao.impl.IEngageDAO">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
 </bean>
 <bean id="examdao" class="org.gsxzy.hr.dao.impl.IExamDAO">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
 </bean>
 <bean id="majordao" class="org.gsxzy.hr.dao.impl.IMajorDAO">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
 </bean>

 <!-- 类的注册 -->
 <bean id="testbiz" class="org.gsxzy.hr.biz.TestBiz">
  <property name="tdao" ref="TestTblDAO"></property>
 </bean>
 <bean id="usersbiz" class="org.gsxzy.hr.biz.impl.IUsersBiz">
  <property name="userdao" ref="usersdao"></property>
 </bean>
 <bean id="users" class="org.gsxzy.hr.entity.Users"></bean>
 <bean id="engagebiz" class="org.gsxzy.hr.biz.impl.IEngageBiz">
  <property name="engagedao" ref="engagedao"></property>
  <property name="majordao" ref="majordao"></property>
 </bean>
 <bean id="exambiz" class="org.gsxzy.hr.biz.impl.IExamBiz">
  <property name="examdao" ref="examdao"></property>
 </bean>
 <bean id="test" class="org.gsxzy.hr.dwr.Test"></bean>
 <bean id="engagedwr" class="org.gsxzy.hr.dwr.Engage">
  <property name="engagedao" ref="engagedao"></property>
  <property name="majordao" ref="majordao"></property>
 </bean>
 <bean id="examdwr" class="org.gsxzy.hr.dwr.Exam">
  <property name="examdao" ref="examdao"></property>
 </bean>
 <bean id="majorbiz" class="org.gsxzy.hr.biz.impl.IMajorBiz">
  <property name="majordao" ref="majordao"></property>
 </bean>


 <bean name="/test" class="org.gsxzy.hr.web.action.TestAction">
  <property name="testbiz" ref="testbiz"></property>
 </bean>
 <bean name="/user" class="org.gsxzy.hr.web.action.UserAction">
  <property name="usersbiz" ref="usersbiz"></property>
  <property name="user" ref="users"></property>
 </bean>
 <bean name="/zhaopin"
  class="org.gsxzy.hr.web.action.ZhaopinAction">
  <property name="engagebiz" ref="engagebiz"></property>
  <property name="majorbiz" ref="majorbiz"></property>
 </bean>
 <bean name="/exam" class="org.gsxzy.hr.web.action.ExamAction">
  <property name="exambiz" ref="exambiz"></property>
 </bean>
 <bean name="/major" class="org.gsxzy.hr.web.action.MajorAction">
  <property name="majorbiz" ref="majorbiz"></property>
 </bean>
</beans>

原创粉丝点击