Re: Frameworks: XML vs Annotations
On Jul 13, 9:41 am, markspace <-@.> wrote:
On 7/13/2011 7:39 AM, Steve wrote:
As much as I detest XML, I think the XML option in Spring might best
provide such a "map" versus annotations. Additionally an XML conf=
ig
file would make it easier to change the flow as all flow mappings
would be in one place.
No experience specifically with Spring, but generally XML is the old way
and in disfavor, and annotations are the new way and preferred.
If you want to build a map of your annotations, consider an annotation
processor:
<http://download.oracle.com/javase/6/docs/technotes/guides/apt/index.html=
<http://download.oracle.com/javase/6/docs/api/javax/annotation/process...=
Some IDE will do this for you with some frame works. E.g., NetBeans an=
d
JSF.
Spring, in particular, should be eschewed in favor of more standard
(Java EE) annotations.
For the primary question, sometimes XML configuration is helpful but
poorly-trained programmers tend to go config-file-happy with it, and
that's bad. Consider a scenario where all screen widgets are defined
in XML configuration files. Many find this excessively fragmented and
difficult to maintain, contrary to the golly-gosh-gee-whiz proponents
who claim the approach to be "flexible". OTOH, to configure i18n
resources or database connections, external XML is very handy,
allowing reconfiguration of external resources without recompiling or
rebuilding an entire application as annotation changes would require.
So the answer to the "XML or annotations?" question is, "It depends."
--
Lew