Could not resolve placeholder 'jdbc.driver' in value "${jdbc.driver}"

代码

img

<beans xmlns="


xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance%22

xmlns:context="
Not Found! http://www.springframework.org/schema/context%22

   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">
<context:property-placeholder location="classpath:database.properties"/>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
    <property name="driverClass" value="${jdbc.driver}"/>
    <property name="jdbcUrl" value="${jdbc.url}"/>
    <property name="user" value="${jdbc.username}"/>
    <property name="password" value="${jdbc.password}"/>
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" value="dataSource"/>
    <!--   绑定mybatis的配置文件     -->
    <property name="configLocation" value="mybatis-config.xml"/>
</bean>
<!-- 4.配置dao接口扫描包,动态实现了Dao接口可以注入到Spring容器中!   -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
    <property name="basePackage" value="com.kuang.dao"/>
</bean>

问题:at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'jdbc.driver' in value "${jdbc.driver}"

为什么不使用阿里的连接池?另外你的连接配置是不是有问题,前面需要加jdbc.吗?你的database.properties里面的key难道是类似jdbc.driver吗?如果key是类似driver=xxx的,配置文件里的变量就不是jdbc.driver而是driver

database.properties看下