Meera has posted 70 posts at DZone. You can read more from them at their website. View Full User Profile

Spring Recipes: A Problem-Solution Approach

  • submit to reddit
Published by: Apress
ISBN: 1590599799

Reviewer Ratings




Buy it now

One Minute Bottom Line

Spring Recipes covers Spring 2.5 from basic to advanced, and introduces several common Spring projects that will bring significant value to your application development. The books is divided into 19 chapters; and these chapters are organized into 3 parts. The author starts off by discussing the Spring IoC container, Spring AOP and AspectJ, Spring data access support, Spring transaction management, Spring Web and Portlet MVC, Spring testing support, Spring support for remoting, EJB, JMS, JMX, E–mail, scheduling, and ends the book with scripting languages. This book also introduces several common Spring Portfolio projects that will bring significant value to your application development, including Spring Security, Spring Web Flow, and Spring Web Services.


The Spring Recipes book covers a significant number of technologies. I liked the way the author has organized the book. Each chapter of this book discusses a Spring topic; each topic has multiple problem-solution recipes as shown below.

Part 1: Core: This part focuses on the core concepts and mechanisms of the Spring framework. The chapters in this part aim to familiarize you with Spring's core. The most important contribution to programming world by Spring is its implementation of IoC design principal.For those who haven’t been introduced to IoC, the author does a very detailed job of explaining how an IoC container operates. If you are using Spring for the first time, chapters 1-4 are a must read. Chapter 1-4 are dedicated to IoC, and also introduces basic bean configuration which is required for reading the subsequent chapters, Chapters 5 and 6, explains why you need AOP, AOP usage, and some advanced AOP topics, including how to integrate the AspectJ framework within your Spring applications.

Part 2 : Fundamentals: The topics covered in this part are most commonly used in developing any enterprise application. The first two chapters in this part, chapter 7, 8 and 9 show how to use Spring to simplify data access (with JDBC, Hibernate, and JPA) and manage transactions programmatically and declaratively and also explains transaction attributes in detail. Next, in chapter 10 the author discusses web-based application development using the Spring MVC framework; you get to learn Spring MVC using both the traditional approach and the new annotation-based approach.

If you don't want to use Spring MVC, you don't have to, you still can use Spring with any other popular web application framework out there, and that;s exactly what is covered in chapter 11:Integrating Spring with Other Web Frameworks. On finishing this chapter, you should be able to integrate Spring into web applications implemented with Servlet/JSP and other frameworks such as Struts, JSF and DWR.

Part 2 finishes with one more chapter, Spring Testing Support. And in this you will learn the basic concepts and techniques of testing using the two most popular frameworks JUnit and TestNG. You will also learn how to create unit tests and integration tests using both the JUnit 3.8 support and also the Spring TestContext framework.

Part 3: Advanced: If you are an advanced Spring user, this part is definitely for you. Chapter 13, discusses security concepts (authentication, authorization, and access control), and securing web applications using Spring Security 2.0, formerly known as Acegi Security. Chapter 14, introduces portlet application development using Spring Portlet MVC framework, and focusses on the portlet specific features.

The next chapter, focusses on how to use Spring Web Flow to model and manage your web applications UI flows. It covers using Spring Web Flow 2.0 in Spring MVC and JSF.

Remote services are part of any enterprise services. Earlier, EJBs were one of the most common way to implement such services.Spring, on the other hand provides support for various remoting technologies such as RMI, Hessian, Burlap, HTTP Invoker, and Web Services; and all these topics are covered with great detail in Chapter 16: Spring and Remoting and Web Services. I am no big fan of writing the WSDL first, which is the basic requirement for contract-first web services. But, if you are than this chapter also covers developing contract-first web services using Spring Web Services.

I am huge fan of the latest Java EE specification, and Chapter 17: Spring support for EJB and JMS discusses how to develop EJB 2.x and 3.0 components with Spring's EJB support, and also how to use Spring's JMS support to simplify sending, receiving, and listening yo JMS messages.

Chapter 18: Spring support for JMX, E-mail and Scheduling, the author discusses how to export Spring beans as JMX MBeans by using MBeanExporter. Spring also allows you to define JSR-160 connectors in the IoC container to expose your MBeans for remote access over a specific protocol. You will also see an example of how to annotate your beans with Spring’s JMX annotations, and Spring can detect and export these as MBeans automatically. Spring’s e-mail support makes it trivial for sending e-mail by providing an abstract and implementation-independent API for sending e-mail. Spring comes with utility classes for both JDK Timer and Quartz for you to configure scheduling tasks in the bean configuration file, without programming against the JDK Timer and Quartz APIs and you will see examples of using both these in this chapter.

JRuby, Groovy, and BeanShell are the most popular scripting languages in the Java community and Spring 2.5 supports these three scripting languages. Chapter 19: Scripting in Spring is all about these scripting languages and Spring. You will learn how to use the scripting languages supported by Spring to implement your beans and how to declare them in the Spring IoC container. You will see examples on how specify the location for an external script source file or define an inline script source in the bean configuration file. As the script sources may require frequent and dynamic changes, Spring can detect and refresh changes from the script source files automatically. Finally, you will get to work with an example which shows how to inject property values as well as bean references into your scripts.

There is only one possible rating for this book. 5 stars all around. The only two things which really are not negatives: I might have liked to see more testing samples, the other one being its enormous weight(nearly 725 pages).

Published at DZone with permission of its author, Meera Subbarao.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


garymak replied on Thu, 2008/09/25 - 5:03am

Thank you for the review, Meera!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.