1

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.

Jonathan Holloway
  • 62,090
  • 32
  • 125
  • 150

3 Answers3

5

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
  • 75,535
  • 32
  • 152
  • 208
3

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

Eugene Ryzhikov
  • 17,131
  • 3
  • 38
  • 60
  • 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. – Jonathan Holloway Jun 15 '09 at 17:40
0

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
  • 5,167
  • 6
  • 29
  • 32
  • Ooh.. Jasypt is what I am looking for on a project we are doing - thanks! – Fortyrunner Jun 15 '09 at 21:54
  • this thread may provide some good insight: http://stackoverflow.com/questions/258299/best-practices-for-storing-database-passwords/421684#421684 – neesh Jun 15 '09 at 22:15