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

怎样以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"/>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题