NoXML: Spring for XML Haters

NFJS, the Magazine - August 2011

In spite of all of the great things Spring brings to Java development, one criticism it has received a lot of over the years is its heavy use of XML for configuration. It's true that Spring configuration has traditionally required XML. Lots of XML. It seems that XML has fallen out of favor with many developers. And for those who are card-carrying members of the He-Man XML Haters Club, it's hard to see the benefits of Spring through the haze of XML. If you're among the XML haters, then this article is for you. Each version of Spring has taken steps to lighten the XML burden and I'm going to show you a few tricks from the latest versions of Spring that make it possible to develop a Spring application with minimal or even no XML whatsoever. To illustrate these techniques, I've written a simple Guestbook application using common Spring XML configuration. Throughout this article, we'll swap XML configuration for Java configuration, until there is no more XML left in the project. If you want to follow along, you can download the before and after projects from this magazine's download URL.

An online version of this article is not available. This article is available in PDF, MOBI, and EPUB to those who have subscribed.

About Craig Walls

Craig Walls

Author of Spring in Action

Craig Walls is a principal engineer with Pivotal and is the author of Spring in Action and Spring Boot in Action. He's a zealous promoter of the Spring Framework, speaking frequently at local user groups and conferences and writing about Spring. When he's not slinging code, Craig is planning his next trip to Disney World or Disneyland and spending as much time as he can with his wife, two daughters, 2 birds and 3 dogs.

NFJS, the Magazine - August 2011

NFJS the Magazine - August 2011

In this Issue: