views:

202

answers:

3

I'm curious as to what other people use in the Java world for configuring their applications. I've previously used Spring's PropertyPlaceHolderConfigurer and PropertyOverrideConfigurer to load various properties files and bind them using the default Spring property editors.

This is a perfectly acceptable solution for what I've done, but I wondered is there was a better alternative for application configuration that somebody has used?

If you have used a better approach could you provide a list of advantages of using a Spring approach. Many thanks in advance.

+3  A: 

If you are using Spring, the approach you've adopted IS the best. Otherwise you'd have to load property or XML files yourself.

eugener
Sure, my question is what are the other alternatives though... not necessarily using Spring. I'm not asking whether I have chosen the best solution here.
Jon
+4  A: 

You could also try something like Constretto, which handles different environments (test, acceptance, production etc) a little more gracefully.

Before diving into Constretto also be advised that Spring 3.0 is changing this landscape quite dramatically, with spring-el being the first thing that comes to mind. Even today the documentation spring 3.0-M3 reveals quite a lot.

krosenvold
A: 

I like spring's PropertyPlaceHolderConfigurer and have used it on most of my projects. What I like most about it (and Spring in general) is that it is very flexible. For example, I have used it along with Jasypt to provide database username/passwords to datasources I configure using spring even when the passwords are stored in the property file in an encrypted format.

A good example of this technique is illustrated here

neesh
Ooh.. Jasypt is what I am looking for on a project we are doing - thanks!
Fortyrunner
this thread may provide some good insight: http://stackoverflow.com/questions/258299/best-practices-for-storing-database-passwords/421684#421684
neesh