日期:2014-05-17 浏览次数: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" [color=#FF0000]class="org.apache.commons.dbcp.BasicDataSource">[/color] <property name="driverClassName" value="com.mysql.jdbc.Driver"> </property> <property name="url" value="jdbc:mysql://localhost:3306/mytest"> </property> <property name="username" value="root"></property> <property name="password" value=""></property> </bean> <!-- 一配置id 为dataSource 的bean,该bean 是个数据源实例一 <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> </property> <property name="url"> <value>jdbc:mysql://localhost:3306/mytest</value> </property> <property name="username"> <value>root</value> </property> <property name="password"> <value></value> </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> com/soulab/mybbs/beans/MybbsForums.hbm.xml </value> <value> com/soulab/mybbs/beans/MybbsGroups.hbm.xml </value> <value>com/soulab/mybbs/beans/MybbsPosts.hbm.xml</value> <value> com/soulab/mybbs/beans/MybbsThreads.hbm.xml </value> <value>com/soulab/mybbs/beans/MybbsUsers.hbm.xml</value> <value> com/soulab/mybbs/beans/ForumViewIndex.hbm.xml </value> <value> com/soulab/mybbs/beans/PostViewViewthread.hbm.xml </value> <value> com/soulab/mybbs/beans/ThreadViewForumdisplay.hbm.xml </value> </list> </property> </bean> <bean id="mybbsForumsDAO" class="com.soulab.mybbs.daos.MybbsForumsDAO"> <property name="sessionFactory"> <ref bean="sessionFactory" /> </property> </bean> <bean id="mybbsGroupsDAO" class="com.soulab.mybbs.daos.MybbsGroupsDAO"> <property name="sessionFactory"> <ref bean="sessionFactory" /> </property> </bean> <bean