【发布时间】:2012-05-03 08:16:12
【问题描述】:
我的 OSGi 包中有 config.properties。但 OSGi 包无法读取它。
Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=dao, config=osgibundle:/META-INF/spring/*.xml))
org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException
我正在使用Spring阅读config.properties
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="config.properties" />
</bean>
OSGi 似乎只读取.xml 文件。
有人知道吗?
【问题讨论】:
-
找不到您的 config.properties 文件。它位于您的捆绑包中的什么位置?
-
我把它放在 META-INF 文件夹中。我想找到一种方法将配置文件放在捆绑包之外,并且行为类似于全局配置设置。有可能吗?