the best way that I've found to do this is to use a default file for common
props and just override the differences in an environment specific file. 
Spring has support for this...

   <bean id="propertyPlaceholderConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="ignoreResourceNotFound" value="true" />
        <property name="locations">
                <list>
                   
<value>classpath:/environments/default.properties</value>
                    <value>classpath:/environments/${env}.properties</value>
                     ...

then, you can run your app using -Denv=dev, etc...


Raji wrote:
> 
> It would be nice to have the Property Placeholder support recursive
> substitution. I use this feature in Spring to configure properties for
> various environments. For example:
> 
> db.URL= ${${env}.db.URL}
> 
> dev.db.URL=jdbc:jtds:sqlserver://S08DX01:7531/UserAcnt
> test.db.URL=jdbc:jtds:sqlserver://S08DXK01:1433/UserAcnt
> prod.db.URL=jdbc:jtds:sqlserver://S08DXJ01:8413/UserAcnt
> 
> Then in the JVM launch I just have to use -Denv=dev for the dev
> environment. But this concept does not work for the Camel Property Place
> Holder.  I tried to invoke Spring's Place Holder using the Endpoint URI
> option but there also it fails.
> 
> I can achieve something similar by using the Spring Placeholder to specify
> the name of the properties file for the different environment:
> 
> <propertyPlaceholder id="properties"
> location="classpath:${env}-file-poll.properties"/>
> 
> and then have three separate properties file dev-file-poll.properties,
> test-file-poll.properties,etc. 
> 
> I am trying to avoid creating separate properties file for this as it
> becomes a maintenance headache. Probably using the Registry or the
> Blueprint services I can achieve similar results. Any other options?
> 
> Thanks
> Raji
> 


-----
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: 
http://camel.465427.n5.nabble.com/Recursive-Property-Placeholder-tp4727692p4727819.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to