我有一个弹簧应用程序,它依赖于传统的弹簧应用程序,以jar的形式发货。请注意,遗留的jar在jar本身里面有它的spring配置文件。那么有两个属性文件:app.properties和override.properties。
现在从外项目,我可以使用类似读一个配置属性:
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" ref="propertyResource"></property>
</bean>
<bean name="propertyResource" class="org.springframework.core.io.ClassPathResource">
<constructor-arg><value>spring-config.properties</value></constructor-arg>
</bean>
但我无法让2个属性文件。有人遇到过类似的问题并找到了解决办法吗?请提出建议。我尝试使用propertyResource
豆的列表,有两个PropertyPlaceholderConfigurer
豆,但没用。我只搜索了(但不是彻底的)春天的文档,所以这将是我将要做的下一件事,但如果有人已经知道这个解决方案,为什么重新发明轮子。
我试过这个。不知何故,我无法使用此方法加载jar中存在的属性文件。我也尝试使用“classpath *”。 – cheekoo 2011-01-31 17:27:07