未从java spring获取类路径中的属性文件
我正在使用PropertyPlaceHolderConfigure从eclipse中的类路径访问属性文件未从java spring获取类路径中的属性文件,java,spring,Java,Spring,我正在使用PropertyPlaceHolderConfigure从eclipse中的类路径访问属性文件 <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location"> <value>classpath :database.properties</value&g
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath :database.properties</value>
</property>
</bean>
初始化xml错误时找不到database.properties文件。
<context:property-placeholder location="/WEB-INF/classes/*.properties" />
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>${app.jdbc.username}</value>
<value>${app.jdbc.password}</value>
</property>
</bean>
${app.jdbc.username}
${app.jdbc.password}
我不确定类路径:
是否应该在那里?
<context:property-placeholder location="/WEB-INF/classes/*.properties" />
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>${app.jdbc.username}</value>
<value>${app.jdbc.password}</value>
</property>
</bean>