0

I'm trying to use PropertiesFactoryBean to load all files ending with .propfrom certain directory.

<bean id="props" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
  <property name="location" value="file:/etc/app/*.prop"/>
</bean>

When running this as Junit test, everyting works OK and org.springframework.core.io.support.PropertiesLoaderSupport#loadProperties get list of all files (wildcard expanded) as FileSystemResource and loads them.

However when running in OSGI environment (Karaf) PropertiesLoaderSupport#loadProperties will get single OsgiBundleResource with path set to /etc/app/*.prop which is invalid, of course.

karolkpl
  • 2,189
  • 10
  • 39
  • 60

1 Answers1

0

Try to use the locations property instead of location (which supports only one resource)

<bean id="props" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
  <property name="locations" value="file:/etc/app/*.prop"/>
</bean>
Jérémie B
  • 10,611
  • 1
  • 26
  • 43