Chad - Hmmm... here's an idea... no guarantees it will make any sense because it's early in the morning (well, not 2:44AM early...but I digress)...
Instead of using the Spring "Property Configurator"... I inject my own "MultiplePropertyConfigurer" which is property loader that can do more tricks than the standard beast using static lookups from my "Configuration" class. So here is the idea... do something similar, wrap the existing PropConfigurator and check for a special "versionNumber" lookup key then deal with that differently. "Differently" meaning something like loading the file from the classpath and returning the entire content as the value. Your milieage may vary, I make no guarantees, my wrist is not broken, but what I've typed above may still be crap. <grin> Cheers, Timo package com.foo.bleck; import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.Properties; /** * Attempt to provide files for multiple environments using only one properties file. * * foo=default_value * lcl.foo=local_value * dev.foo=dev_value * */ public class MultiPropertyConfigurer extends PropertyPlaceholderConfigurer{ public static Log log = LogFactory.getLog("MPC"); protected String resolvePlaceholder(String s, Properties properties) { String prop = Configuration.getProperty(s); String ppc_prop = null; // If we cannot find it, try the parent. if (null == prop) { ppc_prop = super.resolvePlaceholder(s,properties); } String val = (prop != null) ? prop : ppc_prop; // log.info("MPC:"+s+"="+val + " ppc_prop="+ ppc_prop ); return (val != null) ? val : ppc_prop; } } > -----Original Message----- > From: Chad Woolley [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 14, 2005 2:44 AM > To: jug-discussion@tucson-jug.org > Subject: Re: [jug-discussion] "Simple" Spring question > > Thomas Hicks wrote: > > > I suspect you already know that *if* the file was in Java > Properties > > (i.e. key=value) format > > that you could have Spring inject the value directly into > your bean, as > > illustrated below > > where I am assuming that the file 'AntHillPro.properties' > contains a > > line like: > > anthillpro.version=5.6 > > I had thought of that. Anthill will increment the last > parsable number > in the file and ignore everything else, so it would definitely work. > However, I did want to avoid having the specialize the format of the > file and add extra stuff other than just the number, because > the number > in it is used for other purposes (building artifact ids, for example). > > I guess I could post-process it somehow to add the extra stuff after > reading it, or remove it when used for other purposes, but > that starts > getting complicated again. > > -- Chad > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]