日期:2014-05-20 浏览次数:20734 次
<?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.hibernate.dialect.MySQLDialect"> <property name="driverClassName" value="com.mysql.jdbc.Driver"> </property> <property name="url" value="jdbc:mysql://localhost:3306/test"> </property> <property name="username" value="sa"></property> <property name="password" value="aa"></property> </bean> --> <!-- 数据库配置 --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <!-- <property name="dataSource"> <ref bean="dataSource"/> </property> --> <property name="configLocation"> <value>classpath:hibernate.cfg.xml</value> </property> </bean> <!-- DAO实例配置 --> <!-- <bean id="baseDAO" class="com.onest.firstssh.dao.Impl.BaseDAO"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <bean id="userDAO" class="com.onest.firstssh.dao.Impl.UsersDAO" parent="baseDAO"> </bean> --> <bean id="userDAO" class="com.onest.firstssh.dao.Impl.UsersDAO"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <!-- Service实例BEAN管理 --> <bean id="userService" class="com.onest.firstssh.service.Impl.UsersService"> <property name="userDAO"> <ref bean="userDAO"/> </property> </bean> <!-- Action Bean实例管理 --> <bean id="login" class="com.onest.firstssh.actions.Login" scope="prototype"> <property name="userService"> <ref bean="userService"/> </property> </bean> </beans>