有没有蝈蝈会spring啊?
本人在用spring整合hibernate配置连接池连接数据库的时候老是连接不上,也不知道为什么。而单独用jdbc或hibernate时怎么都能连上,郁闷。
希望会的蝈蝈指教啊
配置文件allpicationContext.xml:
<?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.mysql.jdbc.Driver</value>
</property>
<property name="jdbcUrl">
<value>jdbc:mysql://localhost/spring</value>
</property>
<property name="user">
<value>root</value>
</property>
<property name="password">
<value>123</value>
</property>
<property name="minPoolSize">
<value>5</value>
</property>
<property name="maxPoolSize">
<value>30</value>
</property>
<property name="initialPoolSize">
<value>6</value>
</property>
<property name="maxIdleTime">
<value>60</value>
</property>
<property name="acquireIncrement">
<value>5</value>
</property>
<property name="idleConnectionTestPeriod">
<value>60</value>
</property>
<property name="acquireRetryAttempts">
<value>30</value>
</property>
<property name="breakAfterAcquireFailure">
<value>true</value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="mappingResources">
<value>hibernate/User.hbm.xml</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.autoReconnect">
true
</prop>
</props>
</property>
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<!-- dao -->
<bean id="userdao" class="dao.UserDAO">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<bean id="test" class="test.Test">
<property name="ht">
<ref bean="hibernateTemplate"/>
</property>
</bean>
</beans>
[ 此贴被随风而飘在2007-06-03 12:31重新编辑 ]