<bean id="aDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>${adriver}</value> </property> <property name="url"> <value>${aurl}</value> </property> <property name="username"> <value>${ausername}</value> </property> <property name="password"> <value>${apassword}</value> </property> </bean> <bean id="bDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>${bdriver}</value> </property> <property name="url"> <value>${burl}</value> </property> <property name="username"> <value>${busername}</value> </property> <property name="password"> <value>${bpassword}</value> </property> </bean> <!-- Hibernate SessionFactorys --> <bean id="aSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref local="aDataSource" /> </property> <property name="mappingResources"> <list> <value>.hbm.xml文件</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${ahibernate.dialect}</prop> <prop key="hibernate.show_sql">true</prop> <prop key="format_sql">true</prop> </props> </property> </bean> <bean id="bSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref local="bDataSource" /> </property> <property name="mappingResources"> <list> <value>.hbm.xml文件</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${bhibernate.dialect}</prop> <prop key="hibernate.show_sql">true</prop> <prop key="format_sql">true</prop> </props> </property> </bean>