webroot路径问题??
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>/WEB-INF/classes/jdbc.properties</value>
</property>
</bean>
jdbc.properties和applicationContext.xml在同一目录下,怎么读不到??
action层
ApplicationContext ctx =
new ClassPathXmlApplicationContext("applicationContext.xml");
Caused by: java.io.FileNotFoundException: class path resource [WEB-INF/classes/jdbc.properties] cannot be opened because it does not exist
------解决方案--------------------你检查过这个位置没有?
/WEB-INF/classes/jdbc.properties
------解决方案--------------------既然是在classes,实在不行就直接:
<value>classpath:jdbc.properties</value>
------解决方案--------------------<!-- 数据源的properties配置导入 -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:jdbc.properties</value>
</property>
</bean>
------解决方案--------------------ApplicationContext ctx =
new ClassPathXmlApplicationContext("applicationContext.xml");
可以换种方式