Chhotisiaasha's Blog

Spring PropertyPlaceHolder Configuration

Posted on: November 30, 2010

There should be a PropertyHolder class

public class PropertyHolder {

String udiBaseURL;

public String getUdiBaseURL() {
return udiBaseURL;
}

public void setUdiBaseURL(String udiBaseURL) {
this.udiBaseURL = udiBaseURL;
}

}

And in applicaiton.properties file,

//entries for all properties

udi.viewer.url.base=http://udiviewer.qa.pwj.com

Then, In applicationContext.xml make an entry for the class and property file like below:

<bean id=”propertyConfigurer”>
<property name=”location” value=”/WEB-INF/application.properties” />
</bean>

<!– Local Data Holder –>
<bean id=”propertyHolder”>
<property name=”udiBaseURL” value=”${udi.viewer.url.base}” />
</bean>

thats it!!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: