Access and use Java Properties in Spring Context file

This seems like such a simple thing to do, and yet finding a nice simple example online was a real bear (A BEAR!!! actually). So here is my example so the next person will have an easier time of it.

Add properties to your properties file:


Load the properties file inside the context file:

<property name=”locations”>

Access properties from the properties file when setting properties of a bean:

<bean id=”searchButtonBean” init-method=”init” class=”javax.swing.JButton”>
<property name=”text”>
<property name=”buttonIcon” value=”${}”/>

About Jayson
Father, mountain biker, Software development manager at a wire service, and also work with the IPTC (

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: