我在一个控制台Java应用程序中使用Spring的外荷载属性文件。 我将应用程序部署,如:春控制台应用程序,从JAR
folder/myJar.jar
folder/db/connection.properties
如何加载connection.properties在应用程序上下文中的PropertyPlaceholderConfigurer
?
我已经试过
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="db/connection.properties"/>
</bean>
,但它不会工作。
我需要它这样对我的数据库的用户名/密码和其他细节。
添加“”到你的班级路径? –