7v丶Caesar
2017-01-05 03:25
采纳率: 100%
浏览 860
已采纳

怎样以c3p0连接数据源,搭建ssh框架,求大神看看那个地方配置有问题

<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
          <property name="location" value="classpath:jdbc.properties"></property>
</bean>
<bean id="comboPooledDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
    <property name="driverClass" value="${className}"></property>
    <property name="jdbcUrl" value="${url}"></property>
    <property name="user" value="${user}"></property>
    <property name="password" value="${pwd}"></property>
</bean>
<!-- <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    <property name="dataSource" ref="comboPooledDataSource"></property>
</bean> -->

<!-- LocalSessionFactoryBean用来读取配置文件 -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" value="comboPooledDataSource"/>
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
    <property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!--配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory"/>
</bean>

<bean id="bookAction" class="com.aaa.action.BookAction">
    <property name="bookService" ref="bookService"></property>
</bean>
<bean id="bookDao" class="com.aaa.dao.BookDao">
    <property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>

<bean id="bookService" class="com.aaa.service.BookService">
    <property name="bookDao" ref="bookDao"></property>  
</bean>

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • JE_GE 2017-01-06 04:50
    已采纳
     <property name="dataSource" value="comboPooledDataSource"/>
     <property name="dataSource" ref="comboPooledDataSource"/>
    
    已采纳该答案
    打赏 评论
  • JE_GE 2017-01-06 04:50


    打赏 评论

相关推荐 更多相似问题