Why Spring?

Mark Petrovic asks: “Can you say a bit about why you are using Spring in this overall context?”—referring to my earlier post on configuring JXTA with Spring.

I suppose the reason is that over the last few years I have written several servers, mostly experimental prototypes. I quickly got tired of writing and maintaining the large amounts of “glue” code needed in almost every situation: where and how to get application configuration constants and preferences; where and how to specify which implementations of an interface to use in some particular case; etc. Then one day I picked up Rod Johnson’s Expert One-on-One J2EE Development without EJB which, in addition to being a thoughtful critique of Java architecture-as-usual is also a good introduction to Spring.

I built my next server with Spring and have never looked back. In fact, it’s so useful that I don’t consider it only for servers anymore. It’s lightweight enough to use for just about any purpose. Also, if I have to write a web application, I prefer the design of Spring MVC to Struts. And when you throw in the fact that you get declarative transactions and aspects, caching with EHCache, and countless other goodies with virtually no effort, it’s almost too good to be true.

So…I’m writing a fairly complex JXTA application (not a prototype this time) and Spring was the natural choice to make that as pain-free as possible. I hope that answers the question. I’m not by any means a Spring expert. It solves a lot of problems I encounter again and again, but it does a lot more that I haven’t even discovered yet. I will also add that it’s the best designed and written piece of code I’ve seen in many years. Just reading through the source you can learn a lot about how to craft great software.

One thought on “Why Spring?”

  1. I’m half way through “Spring in Action” by Walls and Breidenbach. While I cannot yet think in Spring, I can tell using Spring in my apps is going to be liberating – and fun. Sometimes you can just sense these things – this is one of those times.



Leave a Reply

Your email address will not be published. Required fields are marked *