首页 > 代码库 > spring整合mybaits时Connections could not be acquired from the underlying database!异常解决

spring整合mybaits时Connections could not be acquired from the underlying database!异常解决

<?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.xsd
		http://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 =http://www.mamicode.com/"com/leo/resources/db.properties"/>>


当我使用这句读取数据源文件时,就总是找不到

<context:property-placeholder location="classpath:db.properties"/>

换成

<bean id = "propertyConfigurer"  class = "org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" >
	    <property  name ="location"  value =http://www.mamicode.com/"com/leo/resources/db.properties"/>>就可以,我也不知道为什么?

希望可以获得帮助,知道的人可以帮忙解答一下,

spring整合mybaits时Connections could not be acquired from the underlying database!异常解决