| Author |
XML based config vs annotations
|
Piotr Nowicki
Ranch Hand
Joined: Jul 13, 2010
Posts: 610
|
|
Howdy Ranchers!
I guess this might be also treated as a more general discussion, but: recently there was a increased number of things you can configure using annotations (i.e. JEE 6), like Servlets, url mappings, etc. The point is, the annotations are compilation-time feature, and XML is run-time.
So, all those unique, decalrative features i.e. runtime servlet mapping url change is vanished...
So, my question is: do you prefer annotations over XML, or the other way around.
Or maybe you have found a golden ratio, like: use XML for things that frequently changes (or are more likely to change) and annotations for more firm configuration.
Thanks in advance for your replies :-)
Cheers!
|
OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
|
 |
Piotr Rzexniczak
Greenhorn
Joined: Jan 26, 2011
Posts: 4
|
|
Many of frameworks, libraries and other type project allows you to use both: annotations and xml configuration with the higher priority of xml configuration (I mean xml overrides annotations).
So you can safely use annotations during the development phase and if there is a need to change the configuration, you can do this in additional xml file later without recompiling your code.
|
 |
Piotr Nowicki
Ranch Hand
Joined: Jul 13, 2010
Posts: 610
|
|
And that sounds like a golden ratio for me.
Thanks Piotr!
|
 |
 |
|
|
subject: XML based config vs annotations
|
|
|