我正在尝试使用 PropertiesFactoryBean 加载以.prop
某个目录结尾的所有文件。
<bean id="props" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="location" value="file:/etc/app/*.prop"/>
</bean>
当将此作为 Junit 测试运行时,一切工作正常并org.springframework.core.io.support.PropertiesLoaderSupport#loadProperties
获取所有文件的列表(通配符扩展)FileSystemResource
并加载它们。
但是,当在 OSGI 环境(Karaf)中运行时,路径设置为无效,当然PropertiesLoaderSupport#loadProperties
会变得单一。OsgiBundleResource
/etc/app/*.prop