<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="dataScourse"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver">
</property>
<property name="url"
value="jdbc:sqlserver://localhost:1433;databaseName=mydb">
</property>
<property name="username" value="sa"></property>
</bean>
<bean id="SessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataScourse" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.SQLServerDialect
</prop>
<prop key="show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/t3/entity/Users.hbm.xml</value></list>
</property></bean>
<!-- 数据库层 -->
<bean id="UsersDAO" class="com.t3.dao.impl.UsersDAOImpl">
<property name="sessionFactory">
<ref bean="SessionFactory" />
</property>
</bean>
<!-- 代理 service连接DAO层 -->
<bean id="userService" class="com.t3.biz.impl.UserService" scope="singleton">
<property name="userDAO">
<ref bean="UsersDAO"/>
</property>
</bean>
<!-- Struts 内注入 service -->
<bean name="/login" class="com.t3.struts.action.LoginAction">
<property name="userService" ref="userService"></property>
</bean>
</beans>
SSH连接配置文件
最新推荐文章于 2019-10-16 09:19:31 发布