Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 247FF70EF for ; Tue, 29 Nov 2011 11:29:44 +0000 (UTC) Received: (qmail 19210 invoked by uid 500); 29 Nov 2011 11:29:42 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 19140 invoked by uid 500); 29 Nov 2011 11:29:41 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 19132 invoked by uid 99); 29 Nov 2011 11:29:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Nov 2011 11:29:41 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of java.vinicius@gmail.com designates 209.85.215.171 as permitted sender) Received: from [209.85.215.171] (HELO mail-ey0-f171.google.com) (209.85.215.171) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Nov 2011 11:29:34 +0000 Received: by eaad12 with SMTP id d12so4313657eaa.30 for ; Tue, 29 Nov 2011 03:29:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=7stIMoHatt1Rurp5E3y3V2PVuFm7ykvtw64Y5lZ3kLs=; b=jkCgHrkDmv20kyfsRKpXjclVweQOm8GvnB+8zXixnMsuiwL/n4l7qe5MmuYI1Hrvls rxWy11KOIPYTqej9B5wYC/KOEo2EE/cGMROztvq5Zsce1FQKchD8IaRPN6zO5ii2rCIT FWGcbL1G8I9cNcV208w2dP2eHr8LKSmDRxy4I= MIME-Version: 1.0 Received: by 10.213.4.208 with SMTP id 16mr2680033ebs.60.1322566153584; Tue, 29 Nov 2011 03:29:13 -0800 (PST) Received: by 10.14.119.134 with HTTP; Tue, 29 Nov 2011 03:29:13 -0800 (PST) Date: Tue, 29 Nov 2011 11:29:13 +0000 Message-ID: Subject: Commons Configuration - Variable interpolation not working From: Vinicius Carvalho To: user@commons.apache.org Content-Type: multipart/alternative; boundary=00151750d87cc6c00c04b2dded74 --00151750d87cc6c00c04b2dded74 Content-Type: text/plain; charset=ISO-8859-1 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 instead so whenever I have ${app}.maxUsers=10 I want AppName.maxUsers=10 Here's some code: private class AppInterpolator extends StrLookup{ @Override public String lookup(String var) { return "#{"+appName+"}"; } } ConfigurationInterpolator.registerGlobalLookup("app", new AppInterpolator()); config = new CompositeConfiguration(); PropertiesConfiguration localProps = new PropertiesConfiguration(this.getClass().getClassLoader().getResource(PROPERTIES_FILE_NAME)); this.config.addConfiguration(localProps); 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? Regards --00151750d87cc6c00c04b2dded74--