2

I am moving our config properties from a properties file to a database using apache commons DatabaseConfiguration. Works fine. However, it obviously needs database definition, and I want to load that with a jndi datasource name that is itself a property. So I want to keep a property file with that property and one or two others, that would load first and get used by the database configuration.

I have tried about a million permutations and I can't seem to get it to work. If I hardcode the jndi name in the spring config, it works, but whether I include both in the same property configurator or separate ones, whether I use the order property or not...nothing seems to work.

Here's one of my iterations that didn't work:

<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location" value="/WEB-INF/esp.properties" />
    <property name="order" value="10" />
</bean>
<bean id="propertyConfigurer2" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="order" value="20" />
    <property name="properties" ref="dbConfigFactory" />
</bean>

dbConfigFactory there is the factory that includes the databaseconfiguration bean. Does anyone know how to do this?

Entropy
  • 1,219
  • 6
  • 21
  • 45

0 Answers0