I am starting to learn about the Spring framework. I have seen two ways to configure a web application, one uses a web.xml
to configure the servlets ect. The other uses a Java class that implements a WebApplicationInitializer
and is annotation driven.
I was told that, "XML is the old way, no new project should use XML anymore"
. Can anyone tell me why this is? Lots of online resources quote "Convention over Configuration"
, however, using the online learning tools I have access to, the vast majority of examples are using xml configuration. I am finding it very difficult to find relevant examples with Java configuration.
I would also like to know what the pro's and con's of using one over the other are? If it it easier to find resources based around xml configuration, then would it be destructive to future job prospects to side step the Java configuration and focus on xml?