Click here to Skip to main content
13,198,850 members (42,689 online)
Click here to Skip to main content
Add your own
alternative version


7 bookmarked
Posted 1 Apr 2009

Applications Properties in Java

, 4 Jun 2009
Rate this:
Please Sign up or sign in to vote.
Stratagies for managing application properties in Java


This article covers some of the techniques that can be used to store and retreive application configuration data (Aka properties) in a Java application. It currently focuses on software that is deployed to an application server such as websphere.

This artical is not about the broarder configuration management topic also it won't tell you exactly to make use of the configuration data in your application. but it is related.


Most non trivial java applications need some mechanism to deal with environment related application properties. This article covers some techniques that can be used for storing and retreiving applicition configuration data*. It not and article about configuration management and it only touches on the details of how the applications actually use the properties. It will give an overview of some of the options avaliable. This focuses on an application server environment


Configuration data is mostly used as a list of key value pairs.

The approaches

  • No Configuration
  • JVM properties
  • Flat File
    • Class path properties file
    • Directly referenced properties file
    • Ini files
  • Resource environment provider (Within an application server)
  • Database properties
  • Environmental variables

No Configuration (Hard coding)

This is when the application data is kept directly within the application and any changes required for the application code to be changed and the application to be recompiled.

JVM Properties

This is when you keep all your configuration data within the jvm. These values are usually accessed using the System.getProperty method




Environmental variables

This is when the Data is put at the application / environment it can be globally for the operating sytem or with the id

Flat file (Aka properties file)

When a file is used to store the configuration data. The file can be within the application or outside of the application. There are a number of mechanisms to find these and two common approaches are to look them up using a System property to specify their location the other is to look for a class path relative file.

Database properties

When a table is used within a database to keep the application configuration data usually there will be a table that has a column relating to the property / key and a coresponging the the value e.g.

Key / PropertyValue
property.key1key1 value
property.key2key2 value

Resource Environment provider

In Websphere Appllication server 6.1 it is possible to store the properties within a resource environment provider. This enables the properties to be retreived as an object via a JNDI lookup the actual object retreived depends on the how the lookup is implemented but its a mechanism for storing properties.


Resource Environment Provider ->

Commons Configuration ->

Database props ->


Danielp 2009-04-01 - Initial release still work todo


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior)
Australia Australia
First Started developing professionaly in 2004. I have mostly worked across the IBM products with a dash of open source components added in. My IBM Product Experience includes Websphere, DB2, IBM Content Manager EE, RAD. On the Open Source side some of the noteworthy components are Spring, Tapestry, Junit plus a bunch of utility apis.

You may also be interested in...


Comments and Discussions

GeneralMy vote of 2 Pin
Colin Eberhardt4-Jun-09 21:24
memberColin Eberhardt4-Jun-09 21:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171020.1 | Last Updated 4 Jun 2009
Article Copyright 2009 by daniel_at_work
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid