I am using the commons configuration api for managing the application configuration and start up parameters.
This is a web based application with Struts 2 and Spring 3 in my project.
Please help me by configuring spring and beans with annotations !
Spring can read properties files (and read system en environment variables as well) no problem. For this there is a PropertyPlaceHolderConfigurer which can read properties files.
In newer versions of Spring there is a PropertySource abstraction and Environment abstraction which can be used (there is a special placeholder-configurer which adds support for that as well). With the new PropertySource support properties can come from properties files, command line properties, environment properties, servlet context or JNDI (those are the ones supported out of the box).
With either of these you can simply use placeholders (${...}) together with the @Value
annotation (or in xml) to replace the placeholders at runtime.
public class MyClass {
@Value(${some.propertyname:defaultValue})
String property
}