The Artima Developer Community
Sponsored Link

Java Buzz Forum
More DRY with Spring ServletContextPropertyPlaceholderConfigurer

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
dion

Posts: 5028
Nickname: dion
Registered: Feb, 2003

Dion Almaer is the Editor-in-Chief for TheServerSide.com, and is an enterprise Java evangelist
More DRY with Spring ServletContextPropertyPlaceholderConfigurer Posted: Jan 3, 2005 3:31 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by dion.
Original Post: More DRY with Spring ServletContextPropertyPlaceholderConfigurer
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
Latest Java Buzz Posts
Latest Java Buzz Posts by dion
Latest Posts From techno.blog(Dion)

Advertisement
I always hate it when I see a project with confi settings in env variables, properties files, and the myriad of XML deployment descriptors. Spring has helped out a lot with its PropertyPlaceholderConfigurer that allows you to put everything in one place (like a properties file or three) and suck them out into ${variables}. How about getting values into something like a web.xml? One generic solution is to use your build system do the work for you. With ant, you can use filters and when you copy over certain files, ant can do the s/SOME_VALUE/the real value/g. E.g. Turn on filtering when you copy <copy todir="${build.web.dir}/WEB-INF/classes" filtering="true"> <fileset dir="${resources.dir}"/> </copy> Setup tokens to filter on <filter token="smtpHost" value="${smtpHost}"/> ... Juergen just added a new class to what will be Spring 1.1.4: ServletContextPropertyPlaceholderConfigurer. This class looks into the web.xml for <context-param>'s if the ${value} isn't found. This isn't the same as the other solution, as the core value is now in the web.xml, rather than having everything in ONE place, and pushing that to the other config files.

Read: More DRY with Spring ServletContextPropertyPlaceholderConfigurer

Topic: rss readers Previous Topic   Next Topic Topic: They're Serious About Free magazines

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use