[ https://issues.apache.org/jira/browse/CONFIGURATION-363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oliver Heger resolved CONFIGURATION-363. ---------------------------------------- Resolution: Fixed The nested interpolation feature is available with Commons Lang 2.6. A unit test was added to verify that it actually works. However, in the {{StrSubstitutor}} class of Commons Lang the feature is disabled by default. In order to stay compatible with older Lang versions, I did not want to use an API which is available in version 2.6 only. So the configuration API does not provide a convenience method to enable nested interpolation. Rather, you have to switch on this mode manually on the substitutor used by the configuration. This can be done as follows: {code} AbstractConfiguration config = ... config.getSubstitutor().setEnableSubstitutionInVariables(true); {code} > Consider enhancing to allow nested variable interpolation > --------------------------------------------------------- > > Key: CONFIGURATION-363 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-363 > Project: Commons Configuration > Issue Type: Improvement > Components: Interpolation > Reporter: Rob Walker > Assignee: Oliver Heger > Priority: Minor > Fix For: 1.7 > > > It would be really handy of Commons Configuration could support nested > variable interpolation: > org.osgi.framework.system.packages=org.osgi.framework; version=1.4.0, \ > org.osgi.service.packageadmin; version=1.2.0, \ > org.osgi.service.startlevel; version=1.1.0, \ > org.osgi.service.url; version=1.0.0, \ > org.osgi.util.tracker; version=1.3.3 \ > ${jre-${java.specification.version}} > The process being to expand innermost variable references first and work > outwards - this allows for very advance config, such as the above, which can > dynamically detect the Java version and expand a JRE version specific > property into the property being defined. > Care is needed to avoid recursion, which can been handled through use of a > "Cycle Map" that detects of an inner variable has already been referenced. > An example of this can be found in the substVars method of the Apache Felix > org.apache.felix.framework.util.Util class. -- This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira