<?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.0.xsd">
<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://192.168.1.9:1433;databaseName=db_che">
</property>
<property name="username" value="sa"></property>
<property name="password" 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>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/model/TAdmin.hbm.xml</value>
<value>com/model/TSiji.hbm.xml</value>
<value>com/model/TChe.hbm.xml</value>
<value>com/model/TChuche.hbm.xml</value>
</list>
</property>
</bean>
<!-- 后台的登录 -->
<bean id="loginService" class="com.service.loginService">
<property name="adminDAO">
<ref bean="TAdminDAO" />
</property>
</bean>
<bean id="dwrService" class="com.service.DwrService">
</bean>
<bean id="TAdminDAO" class="com.dao.TAdminDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="adminAction" class="com.action.adminAction" scope="prototype">
<property name="adminDAO">
<ref bean="TAdminDAO" />
</property>
</bean>
<bean id="TSijiDAO" class="com.dao.TSijiDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="sijiAction" class="com.action.sijiAction" scope="prototype">
<property name="sijiDAO">
<ref bean="TSijiDAO" />
</property>
</bean>
<bean id="TCheDAO" class="com.dao.TCheDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="cheAction" class="com.action.cheAction" scope="prototype">
<property name="cheDAO">
<ref bean="TCheDAO" />
</property>
<property name="sijiDAO">
<ref bean="TSijiDAO" />
</property>
</bean>
<bean id="TChucheDAO" class="com.dao.TChucheDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="chucheAction" class="com.action.chucheAction" scope="prototype">
<property name="cheDAO">
<ref bean="TCheDAO" />
</property>
<property name="chucheDAO">
<ref bean="TChucheDAO" />
</property>
</bean>
</beans>
已经用可视化软件连接上了 sqlserver
已经增加了一个 lib
sqljdbc4.jar (已经在 java build path 添加 jar,编译器是 myeclipse2014 )