Could not resolve placeholder 'jdbc.driverClass'

来源:互联网 发布:娃娃音的网络女歌手 编辑:程序博客网 时间:2024/05/31 04:03

Invalid bean definition with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Could not resolve placeholder 'jdbc.driverClass'    

 

我自己出这个错是因为properpties中的java build path里的 source 标签下的default output folder 中默认的是: 工程名/bin,要把这个改为工程名/WebRoot/WEB-INF/classes

如果是maven工程则

 

 <outputDirectory>src/main/webapp/WEB-INF/classes</outputDirectory>

另外在spring的第一个加载的配置文件中添加

 <bean id="propertyConfigurer"

    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

<property name="locations">

<list>

<value>classpath*:/jdbc.properties</value>
<value>classpath*:/springjdbc/applicationContext-jdbc.xml</value>

</list>

</property>

</bean>

 

原创粉丝点击