spring整合mybaits时Connections could not be acquired from the underlying database!异常解决
来源:互联网 发布:晋江腾达陶瓷销售网络 编辑:程序博客网 时间:2024/05/18 20:49
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"><!-- 使用注解自动创建bean,设置bean所在的包 --><context:component-scan base-package="com.leo.dao,com.leo.service" /><!-- @Autowired自动装配 <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>--><!-- 配置数据源 --><!-- <context:property-placeholder location="classpath:db.properties"/> --><bean id = "propertyConfigurer" class = "org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" > <property name ="location" value ="com/leo/resources/db.properties"/> </bean><bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"><property name="driverClass" value="${driverClass}"></property><property name="jdbcUrl" value="${url}"></property><property name="user" value="${username}"></property><property name="password" value="${password}"></property></bean><!-- 创建SqlSessionFactory--><bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"><!-- 指定数据源 --><property name="dataSource" ref="dataSource" /><property name="typeAliasesPackage" value="com.leo.entity"></property><property name="mapperLocations" value="classpath*:com/leo/dao/*Mapper.xml" /></bean><!-- 配置事务 --><bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><property name="dataSource" ref="dataSource" /></bean><!-- 映射接口 --><bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"><property name="basePackage" value="com.leo.dao" /><property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" /></bean></beans>
当我使用这句读取数据源文件时,就总是找不到
<context:property-placeholder location="classpath:db.properties"/>
换成
<bean id = "propertyConfigurer" class = "org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" > <property name ="location" value ="com/leo/resources/db.properties"/></bean>就可以,我也不知道为什么?
希望可以获得帮助,知道的人可以帮忙解答一下,
0 0
- spring整合mybaits时Connections could not be acquired from the underlying database!异常解决
- 解决:Connections could not be acquired from the underlying database
- 解决:Connections could not be acquired from the underlying database!
- 解决:Connections could not be acquired from the underlying database!
- 解决:Connections could not be acquired from the underlying database!
- 解决:Connections could not be acquired from the underlying database!
- 解决:Connections could not be acquired from the underlying database!
- 解决:Connections could not be acquired from the underlying database!
- 解决:Connections could not be acquired from the underlying database!
- Connections could not be acquired from the underlying database!异常解决
- Connections could not be acquired from the underlying database!
- Connections could not be acquired from the underlying database!
- Connections could not be acquired from the underlying database
- Connections could not be acquired from the underlying database
- Connections could not be acquired from the underlying database
- Connections could not be acquired from the underlying database!
- 数据库Connections could not be acquired from the underlying database!
- Connections could not be acquired from the underlying database问题解决
- Swift-字典
- 479A - Expression
- WSN 路由协议
- XmlHttpRequest CORS 与 AJAX封装类
- C#(面向对象基础数组VS集合VS范型)下-2
- spring整合mybaits时Connections could not be acquired from the underlying database!异常解决
- Single Number II
- 让MAC系统为你唱中英文生日快乐歌
- c# ArrayList冒泡排序
- Android源码解析之Dialog
- 博客,我们是写给谁看的
- 自定义返回按钮时,iOS7手势返回遇到的问题
- 第十六周项目 4 为动态数组扩容
- 第十六周项目二——用指针玩字符串(1,字符串str1和str2的连接)