Tuesday October 24, 2006
Java Annotations and Configuration Files
Cedric writes:
Ever since annotations officially made it officially in the Java language, the debate has been raging about where configuration should go: in annotations or XML files.
There are cases, which should go as an annotation, such as such as @Test or @Transaction. Others should be in a configuration file, e.g. the location of the log files, etc.
In many cases however, it makes sense to have the defaults in the annotations and provide a possibility to override them in external configuration files.
This is has been possible with Spring’s configuration mechanims, unfortunately there isn’t a way to use a more sophisticated XML file. Also, XBean (an extension to Spring to support domain-specific configuration files) does provide XDoclet tags for default values, but as far as I can see the values are not set to the beans by the XBean application context implementations.
That would make a good patch for Spring and/or XBean IMHO…
Posted on Oct 24, 2006 at 21:32 (MET) | Permalink | Add comment

