My problem looks simple, but I cannot solve it. I have a properties file that contains configuration information for all environments (dev, qa, prod).
An example config.properties:
dev.maxLength=2000
qa.maxLength=4000
We have a parent properties file that contains the host name, environment mappings.
An example hosts.properties:
host1=dev
host2=qa
The name of the property host1is stored in the bean hostname.
<bean id="hostname"
factory-bean="localhostInetAddress"
factory-method="getHostName"/>
To resolve the name of the configuration property, I need to join the strings as follows:
${${**hostname**}.maxLength}which should be resolved as${dev.maxLength}
I tried to use SpEL without success. I get an exception Could not resolve placeholder. How can I combine the bean value in a place holder? How are dynamic property names constructed?
Spring version 3.2
source
share