Image via Wikipedia Annotations have changed every thing and lots of version updates/upgrades are made just to support them. Yes they have developers to get rid of lots of xml schemas and files at the same time,"Annotations have been more successful than XML" But are those XML files really bad ?
Many of you might remember at the spring 1.2.X series there is a strong voice like: easy,quick configurations and implementations with spring Yes in fact that was totally true. It really used POJOs as bean containers. And it works really fine. While using these spring versions you did not usually need to make any import statements for any spring package/class/interface sample classes below were shown as best practices:
At least for some common patterns like DAOs. As a popular manner, most of the java applications have at least three layers like UI, Service and DAO. For each layer you probably have interface and a single or more implementation classes. And while UI layer has some really complex businesses for effective UI experience, DAO layer is only related with CRUD operations for a single or a group of beans. Here is the routine that you can get rid of
Annotations came to JDK with JDK5 (2004) since then they evaluated and are accepted so widely and even became more powerful and useful than XML in just 4 years. While you are developing a project with java at any scale you'll need a very large number of XML files defined in very different API's and DTD/XSDs. Which makes configuration very complex. eg:struts.xml,tiles.xml,validation.xml,hibernate.cfg.xml,spring-context.xml,web.xml,and so on Although it is easy to read and modify there are lots files :( Now with annotations: