commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vinicius Carvalho <>
Subject Commons Configuration - Variable interpolation not working
Date Tue, 29 Nov 2011 11:29:13 GMT
Hi there! I'm trying to get Variable interpolation to work. But it seems
that either I missed something at the docs or there's a bug here.

All I need is to replace a ${app} on my properties file to contain a string

so whenever I have ${app}.maxUsers=10 I want AppName.maxUsers=10

Here's some code:

private class AppInterpolator extends StrLookup{
public String lookup(String var) {
return "#{"+appName+"}";

ConfigurationInterpolator.registerGlobalLookup("app", new
config = new CompositeConfiguration();
PropertiesConfiguration localProps = new

But after using config.getProperty("") I've noticed that the property here
is ${app}.maxUsers and not AppName.maxUsers

I've also noticed that it seems that PropertiesFile does not reference
ConfigurationInterpolator at all.

Any ideas on how to fix this?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message