Hi,
I'm trying to set the property of a bean used by one PropertyPlaceholderConfigurer from a system property like so:
However, when I runCode:<beans> <bean id="systemPropConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /> <property name="ignoreUnresolvablePlaceholders" value="true" /> </bean> <bean class="org.apache.commons.configuration.DatabaseConfiguration" id="dbConfig"> <constructor-arg> <bean id="propertiesDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="database" value="${database}" /> [other properties...] </bean> </constructor-arg> [other constructor-args...] </bean> <bean id="configureProperties" class="org.apache.commons.configuration.ConfigurationConverter" factory-method="getProperties"> <constructor-arg ref="dbConfig" /> </bean> <bean id="dbPropConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="properties" ref="configureProperties" /> <property name="ignoreUnresolvablePlaceholders" value="false" /> </bean> [other beans that get their properties filled in by dbPropConfig...] </beans>
${database} is not expanded when dbConfig is created, and a SQLException ends up getting thrown. I've seen a number of other posts with similar issues, but haven't found a solution yet. Any ideas? I'm using Spring 2.5.4.Code:java -Ddatabase=mydb -jar myjar.jar
Thanks,
-Jesse


Reply With Quote
