<?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:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
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.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<!-- 使用配置文件对数据源属性进行配置 -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:jdbc.properties</value>
</property>
</bean>
<!-- 定义数据源 -->
<bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}"></property>
<property name="url" value="${jdbc.url}"></property>
<property name="username" value="${jdbc.username}"></property>
<property name="password" value="${jdbc.password}"></property>
</bean>
<!--由Spring管理sessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<!--<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>-->
<property name="mappingResources">
<list>
<value>com/dxf/pojo/Bed.hbm.xml</value>
<value>com/dxf/pojo/Bedregister.hbm.xml</value>
<value>com/dxf/pojo/Costcriterion.hbm.xml</value>
<value>com/dxf/pojo/Customer.hbm.xml</value>
<value>com/dxf/pojo/Dormitory.hbm.xml</value>
<value>com/dxf/pojo/Dormitorybuilding.hbm.xml</value>
<value>com/dxf/pojo/Enterpriseorder.hbm.xml</value>
<value>com/dxf/pojo/Personinfor.hbm.xml</value>
<value>com/dxf/pojo/Stayorderconsumeitem.hbm.xml</value>
<value>com/dxf/pojo/Systemlog.hbm.xml</value>
<value>com/dxf/pojo/Systemuser.hbm.xml</value>
</list>
</property>
<property name="dataSource" ref="dataSource"></property>
<!-- 配置数据库方言类 -->
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="current_session_context_class">thread</prop> //此为加载线程级session内之类,优化线程。
</props>
</property>
</bean>
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
/* 下面为接口注入方式*/
<!-- 登陆注入配置 -->
<bean id="logaction" class="com.dxf.action.LoginAction">
<property name="lgservice" ref="loginService"></property>
</bean>
<bean id="loginService" class="com.dxf.service.impl.LoginServiceImpl">
<property name="lgdao" ref="logindao"></property>
</bean>
<bean id="logindao" class="com.dxf.dao.impl.LoginDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!--录入人员信息注入配置 -->
<bean id="RegisterAction" class="com.dxf.action.RegisterAction">
<property name="rgservice" ref="RegisterService"></property>
</bean>
<bean id="RegisterService" class="com.dxf.service.impl.RegisterServiceImpl">
<property name="rg" ref="RegisterDao"></property>
</bean>
<bean id="RegisterDao" class="com.dxf.dao.impl.RegisterDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 查询人员信息注入配置 -->
<bean id="FindAllAction" class="com.dxf.action.FindAllAction">
<property name="faservice" ref="FindAllService"></property>
</bean>
<bean id="FindAllService" class="com.dxf.service.impl.FindAllServiceImpl">
<property name="fadao" ref="FindAllDao"></property>
</bean>
<bean id="FindAllDao" class="com.dxf.dao.impl.FindAllDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 人员信息修改 -->
<bean id="UpdateAction" class="com.dxf.action.UpdateAction">
<property name="upservice" ref="UpdateService"></property>
</bean>
<bean id="UpdateService" class="com.dxf.service.impl.UpdateServiceImpl">
<property name="updatedao" ref="UpdateDao"></property>
</bean>
<bean id="UpdateDao" class="com.dxf.dao.impl.UpdateDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
</beans>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
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.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<!-- 使用配置文件对数据源属性进行配置 -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:jdbc.properties</value>
</property>
</bean>
<!-- 定义数据源 -->
<bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}"></property>
<property name="url" value="${jdbc.url}"></property>
<property name="username" value="${jdbc.username}"></property>
<property name="password" value="${jdbc.password}"></property>
</bean>
<!--由Spring管理sessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<!--<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>-->
<property name="mappingResources">
<list>
<value>com/dxf/pojo/Bed.hbm.xml</value>
<value>com/dxf/pojo/Bedregister.hbm.xml</value>
<value>com/dxf/pojo/Costcriterion.hbm.xml</value>
<value>com/dxf/pojo/Customer.hbm.xml</value>
<value>com/dxf/pojo/Dormitory.hbm.xml</value>
<value>com/dxf/pojo/Dormitorybuilding.hbm.xml</value>
<value>com/dxf/pojo/Enterpriseorder.hbm.xml</value>
<value>com/dxf/pojo/Personinfor.hbm.xml</value>
<value>com/dxf/pojo/Stayorderconsumeitem.hbm.xml</value>
<value>com/dxf/pojo/Systemlog.hbm.xml</value>
<value>com/dxf/pojo/Systemuser.hbm.xml</value>
</list>
</property>
<property name="dataSource" ref="dataSource"></property>
<!-- 配置数据库方言类 -->
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="current_session_context_class">thread</prop> //此为加载线程级session内之类,优化线程。
</props>
</property>
</bean>
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
/* 下面为接口注入方式*/
<!-- 登陆注入配置 -->
<bean id="logaction" class="com.dxf.action.LoginAction">
<property name="lgservice" ref="loginService"></property>
</bean>
<bean id="loginService" class="com.dxf.service.impl.LoginServiceImpl">
<property name="lgdao" ref="logindao"></property>
</bean>
<bean id="logindao" class="com.dxf.dao.impl.LoginDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!--录入人员信息注入配置 -->
<bean id="RegisterAction" class="com.dxf.action.RegisterAction">
<property name="rgservice" ref="RegisterService"></property>
</bean>
<bean id="RegisterService" class="com.dxf.service.impl.RegisterServiceImpl">
<property name="rg" ref="RegisterDao"></property>
</bean>
<bean id="RegisterDao" class="com.dxf.dao.impl.RegisterDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 查询人员信息注入配置 -->
<bean id="FindAllAction" class="com.dxf.action.FindAllAction">
<property name="faservice" ref="FindAllService"></property>
</bean>
<bean id="FindAllService" class="com.dxf.service.impl.FindAllServiceImpl">
<property name="fadao" ref="FindAllDao"></property>
</bean>
<bean id="FindAllDao" class="com.dxf.dao.impl.FindAllDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 人员信息修改 -->
<bean id="UpdateAction" class="com.dxf.action.UpdateAction">
<property name="upservice" ref="UpdateService"></property>
</bean>
<bean id="UpdateService" class="com.dxf.service.impl.UpdateServiceImpl">
<property name="updatedao" ref="UpdateDao"></property>
</bean>
<bean id="UpdateDao" class="com.dxf.dao.impl.UpdateDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
</beans>