The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Spring Note: PropertyPlaceholderConfigurer

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
Ryan Ransford

Posts: 71
Nickname: rdransfo
Registered: Jul, 2008

Ryan Ransford is a Java developer working in the enterprise looking to make the world a better place
Spring Note: PropertyPlaceholderConfigurer Posted: Jun 29, 2010 11:00 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by Ryan Ransford.
Original Post: Spring Note: PropertyPlaceholderConfigurer
Feed Title: Active-Active Configuration
Feed URL: http://active-active.blogspot.com/feeds/posts/default
Feed Description: Active-Active Configuration is a blog about making my place in the enterprise world better. This blog is primarily focused on Java articles, but be prepared to be challenged by posts about dynamic languages, agile tools, and the lighter side of geek culture.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by Ryan Ransford
Latest Posts From Active-Active Configuration

Advertisement

Often there are Spring-related configuration options which don't belong inside the final jar/war for a Java application. Either because the options are different for each deployment environment or because the value of the option is sensitive (passwords). The PropertyPlaceholderConfigurer class attempts to remedy the management and injection of the values for these options. It reads one or more property files, optionally using system properties for defaults, and uses the values found to fill property placeholders of the form ${property name} found in the ApplicationContext in which the configurer is defined.

Advantages:
  • It provides a mechanism for externalizing configuration so that each environment can be configured differently without re-building the application.
  • It provides a mechanism for injecting test properties at test-time without incurring much development overhead.
  • Using the classpath:<file> pseudo-uri enables developers to easily include default properties while still allowing users to over-ride the defaults by adding the location of a properties file to the application's classpath.
  • The PropertyPlaceholderConfigurer is extensible and provides a method, convertPropertyValue(String), which can be over-ridden in a sub-class to handle the encryption of properties.
Disadvantages:
  • The configurer class does not re-load at a regular interval. Changing the properties managed by the configurer requires a restart of the application using it. This can be overcome in some limited situations through a custom sub-class, but for the most part, is not really supported by the Spring container.
  • Only Spring-managed beans can take advantage of these properties.

Sample

config.xml

]]>

project.properties

Read: Spring Note: PropertyPlaceholderConfigurer

Topic: JavaZone 2010 promotional video Previous Topic   Next Topic Topic: Productivity Tools: Launchy

Sponsored Links



Google
  Web Artima.com   

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