Cannot load JDBC driver class '${jdbc.driverClassName}'

org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class '${jdbc.driverClassName}'

配置如下:

<beans default-autowire="autodetect">
 <bean id="propertyConfigurer"
  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
  lazy-init="false">
  <property name="locations">
   <list>
    <value>classpath*:conf/jdbc.properties</value>
    <value>classpath*:conf/hibernate.properties</value>
   </list>
  </property>
 </bean>
 <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${jdbc.driverClassName}"/>
        <property name="url" value="${jdbc.url}"/>
        <property name="username" value="${jdbc.username}"/>
        <property name="password" value="${jdbc.password}"/>
    </bean>

问题分析:

容器并没有加载到jdbc.properties文件,导致抛出了该异常

解决方案:

将<beans default-autowire="autodetect">这句的属性去掉,即直接写<beans>

 

你可能感兴趣的:(apache,bean,Hibernate,jdbc)