Chapter 6. Overview of the Spring Framework


6. Overview of the Spring Framework

WHEN SUN MICROSYSTEMS INTRODUCED the Enterprise JavaBean (EJB) 1.0 specification a few years ago, I was excited at first and even wrote a relatively lengthy article in 1999 for JavaWorld.com (http://www.javaworld.com/javaworld/jw-04-1999/jw-04-middleware.html), essentially summarizing this specification in one article. The article was well received and I was proud of my work.

A year later I wrote a much shorter article, also for JavaWorld.com, titled "Do You Really Need Enterprise JavaBeans?" (http://www.javaworld.com/javaworld/jw-10-2000/jw-1006-soapbox.html).

My motivation for writing this article came from the many projects I ran across that were using EJBs in the wrong manner. For example, I saw nondistributed use of this distributed technology. I even saw simple web applications use EJBs when they could have easily used plain old Java objects (POJOs) in a well-designed application with a clear separation of the tiers (presentation and business tiers, for example).

Furthermore, the role I played in my company required me to interview many developers, and that enabled me to gauge what the mainstream companies, projects, and developers were using. Over a three-to-four-year period, it also enabled me to listen to personal opinions of probably a hundred or so developers about EJBs (and other JEE components). The common theme I saw was that a large majority were using only stateless session beans and the remainder were using a mix of entity beans and message-driven beans; I can't recall anyone using stateful session beans.

So, what is the point of this story? Simple. In my opinion, Sun had defined a standard that was possibly more applicable to the complex applications and less applicable to applications that did not require the many facilities provided by JEE. Furthermore, using EJB on a project meant needing an EJB containerwhich can sometimes translate into an expensive, application server, if your organization chooses to go the commercial route versus using open source products such as JBoss Application Server (jboss.com) or Apache Geronimo (geronimo.apache.org).

When I came across the Spring Framework some time ago, I was thrilled to see that I could work with POJOs and still have many of the services (similar to JEE/EJB) available to me, if I chose to use them. For example, Spring provides robust declarative transaction management.

Dedicating two full and some partial chapters to the Spring Framework does not do it justice because there is so much to cover. However, as you will soon see, the Spring Framework does not take an all-or-nothing approach; that is, you can pick and choose which modules are applicable to you. In this book, we are using Spring for two main features: its web framework and of course, the inversion of control (IoC; also referred to as dependency injection) services. In addition, we will use Spring for scheduling jobs and sending emails. We will not use Spring AOP directly, but indirectly when we use the Spring Web MVC Framework.

Note

From this point, I will refer to the Spring Framework simply as Spring in many places. Also, I will use the terms dependency injection and IoC interchangeably (more on this later in this chapter).




Agile Java Development with Spring, Hibernate and Eclipse
Agile Java Development with Spring, Hibernate and Eclipse
ISBN: 0672328968
EAN: 2147483647
Year: 2006
Pages: 219

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net