Guus Bosman

software engineering director

You are here


Java Config

I have been working on a component for Java programs for a while now. It's called "Java Config", and it provides access to configuration data for Java and J2EE applications.

Chess has recently agreed to publish the software under an Open Source license, which is very cool. It can now by used by anybody who needs a component like Java Config (it is published under a BSD license).
A piece of code, just to give an idea of what it does:

public class SimpleApplication {
  public static void main(String[] args) {
    String sayingHi =  getConfig().getWelcomeText();    
    boolean yesOrNo = getConfig().getMyFirstBoolean();
    int numberOfDays = getConfig().getNumberOfDays(); url = getConfig().getNiceWebsite();

  private MyConfig config;

  private static getConfig() {
    if (config == null) {
        config = new MyConfig("");
        ConfigValidationResult configResult = config.validateConfiguration();
        if (configResult.thereAreErrors()) {
            // display errors here
    return config;

These are the goals Java Config tries to achieve:

  • Type-safe access: int portNumber = getConfig().getFtpPortNumber();
  • Allow an easy check on the validity of a given properties file, most likely at start-up time.
  • Support common configuration data-types like Date, URL, int and boolean.
  • Flexibility in use: no static initializers, no logging-dependencies.

The official project page is located at SourceForge. It's latest stable release is now also available from Ibiblio's Maven repository.

Recent comments

Recently read

Books I've recently read: