随笔 - 6  文章 - 129  trackbacks - 0
<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

常用链接

留言簿(14)

随笔档案(6)

文章分类(467)

文章档案(423)

相册

收藏夹(18)

JAVA

搜索

  •  

积分与排名

  • 积分 - 814459
  • 排名 - 49

最新评论

阅读排行榜

评论排行榜

<?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 阅读(969) 评论(0)  编辑  收藏 所属分类: struts+spring+hibernate

只有注册用户登录后才能发表评论。


网站导航: