<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass">
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
</property>
<property name="jdbcUrl">
<value>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=news</value>
</property>
<property name="properties">
<props>
<prop key="c3p0.minPoolSize">5</prop>
<prop key="hc3p0.maxPoolSize">10</prop>
<prop key="hc3p0.timeout">60</prop>
<prop key="c3p0.max_statement">50</prop>
<prop key="c3p0.testConnectionOnCheckout">true</prop>
<prop key="user">sa</prop>
<prop key="password"></prop>
</props>
</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>bo/Users.hbm.xml</value></list>
</property>
</bean>
<bean id="UsersDAO" class="dao.UsersDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="UserService" class="service.UserService">
<property name="userDAO">
<ref bean="UsersDAO"/>
</property>
</bean>
<bean name="/login" class="org.spell.action.LoginAction" singleton="false">
<property name="userService">
<ref bean="UserService"/>
</property>
</bean>
<bean name="/register" class="org.spell.action.RegisterAction" singleton="false">
<property name="userService">
<ref bean="UserService"/>
</property>
</bean>
</beans>
--------------------------------
在配置的时候 cp30的属性的名字必须是 ''driverClass' , 'jdbcUrl', 'user' , 'password' 而 <property name="properties">的名字也必须是“properties”,另外cp30配置文件的属性名也都是诸如:"c3p0.minPoolSize"、"hc3p0.maxPoolSize"等等
posted on 2007-08-17 14:07
Ke 阅读(980)
评论(0) 编辑 收藏 所属分类:
struts+spring+hibernate