Newsletter:

(Article) Applications Properties in Java

Article : Applications Properties in Java

Introduction:
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.

Background:
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

Definition:
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

{Code}
System.getProperty("props.myproperty");
{/Code]

| Read more..

Courtesy :- Codeproject.com