One Minute Bottom Line
As the first of its kind, this book attempts to introduce just about every facet of Spring. From the core bean dependency injection to UI development with Spring MVC to database simplification with JDBC to batch processing with Spring Batch to system integration with Spring Integration to the simplification of REST via Spring MVC as well as RestTemplate. This is a book for beginners and advanced Spring developers wishing to advance and discover more about Spring and the universe that SpringSource has created.
Spring Recipes is a powerful book initially written by Gary Mak who did a great job on authoring the first edition. Each chapter was logically followed by the next related chapter in a flawless manner. Very little content was rushed.
In the second edition, perhaps as suggested by the editor (Apress), the book was written as a fusion of first edition with the addition of chapters from another book, Spring Enterprise Recipes: A Problem-Solution Approach as well as the addition of new technologies such as Spring Roo. As a consequence the book put on a lot of weight. From a middle weight book it became a heavy weight book. There are over one thousand pages. A the same time this growth in the number of pages illustrates how Spring has matured beyond the core J2EE and has moved into more complex sectors such as Spring Integration, Spring Batch, Spring Roo and so on. It also shows how a framework like Spring which at first was intended to simplify J2EE has in fact revolutionized Java itself. From core Java to Enterprise Java this book exemplifies how Spring is an essential part of just about every facet of Java based systems.
Josh Long, who led the effort in the second edition, has gone far and beyond to make this book more useful in the Spring 3 context. He reviewed most sections from the previous editions and although some unedited sections remain, the concept of Spring 3 is ever present. But with such mammoth effort and the tight deadline this book faced, there are some rather small lapses. From time to time in this review I will attempt to highlight those. For example, small tidbits such as the ApplicationContextAware example were left in the pre-Generics state as written in the previous edition; again, the flow of the book is actually refreshed to exemplify Spring 3 and those small omissions should not dissuade the reader from learning Spring 3.
The second edition loses the introduction to Inversion of Control (IoC) in favor of more hands on examples. Logically this was done in to save the book from competing for size with the Oxford Dictionary. Another major change in this edition is the book sectioning. The previous edition was separated in distinct sections such as core, advanced, etc; those were conducive of Spring 2.x. With the introduction of new concepts such as Spring Batch and Spring Integration, the data access related topics were moved out of the core section and into a chapter nearer to advanced data-centric topics.
As this is a massive book, inevitably some topics received more attention than others. This is caused by the fact that the book attempts be the Spring Encyclopedia. Such feat has not been attempted before in a Spring related book. The pluses of this approach are that the reader if made aware of all that is Spring and the massive effort that went into what is now the Spring Framework. Most readers benefit from this format as the book attempts to cover each topic in one form or another. Having a short introduction on topics such as Spring Roo would lead more developers to explore this Spring project and I think that Spring Roo is one of the most important projects ever introduced in any Java framework. It is so because it simply allows the developer to explore the features and principles of Spring Framework hands one and in a relatively short time; and yes, there are principles in Spring; the most important is the "don't repeat yourself" (DRY principle) and Spring Roo exemplifies that principle.
The book uses Maven and all the examples are maven driven, but unlike the previous edition the examples are not arranged by chapters. This is a slight disadvantage since it makes it harder to find the examples unless they are open via an IDE or simply searched through some find feature. Having the examples arranged by chapters was a major plus but the authors have decided otherwise; perhaps this was done in order to save time. There are plenty of examples and the ones I've compiled and used worked as designed which shows that the quality of the code was properly reviewed.
Core Spring receives a good coverage; from the beginning the author starts with the Maven suggestions and how the latest Spring jars can be obtained. It would have helped to suggest the Spring STS edition of Eclipse which is a perfect and free IDE which includes the m2eclipse plug-in for Maven project integration simplification. The Spring concept is introduced with the now classic Spring applicationContext.xml concept. It highlights faster ways to configure beans via XML; from bean initialization shortcuts to configuring collections such as lists, sets, arrays, maps, and properties. Auto wiring is introduced just before annotations are gently introduced as a means to simplify bean configuration. The advanced section introduces factory method invocations as well as other advanced ways to configure Spring beans. Spring Expression Language (SpEL) is also introduced with meaningful examples. This is followed by bean scopes and bean lifecycle aware beans. As Spring 3 introduced Java Config based bean configuration. One note on this; Java Configuration does not offer all the functionality found in the Spring XML or Spring bean annotations; so do not blame the book for lacking some bean creation examples shown in the `core Spring bean configuration' sections. (tip: wait for Spring 3.1; that will enhance support for Java Configuration).
Spring AOP is now focused on the AspectJ style and the XML style; the `Dynamic Proxy and Classic Spring AOP' chapter has been removed since the first edition of this book should be used if such approach is sought. AOP is a fairly straight forward concept and the book does a good service on introducing the annotation-based and XML-based AOP.
Spring Security focuses on the most popular security approaches; from URL security, to HTTP basic as well as form based security. Authenticating users as well as encrypting data is also exemplified. LDAP Server authentication is a very complete example which shows how to install, configure and integrate with in other to authenticate against LDAP. This is a very complete chapter which shows how to use Spring Security and how to integrate with UI components to exemplify a real time example.
The chapter on with other frameworks is short but complete; integrations such as JSF, Servlets, Filters, Struts 1.x and DWR are exemplified
Spring Web Flow and Spring MVC take center stage. The Spring MVC section introduces REST integration which is a great addition to the already superior web UI framework. By the end of those two chapters the reader should be able to showcase Spring Web Flow as well as Spring MVC with the cool addition of RESTful services.
I've skipped the Flex chapter. So I cannot detail this section.
The chapter on Grails is a great one because it introduces the reader to project simplification through this great dynamic language based on Groovy. Great detail is paid to this chapter and by the end of it the reader should begin to test and harness Spring in a much faster manner. As a personal tip, download the latest edition of Spring STS to simplify the adoption of this great concept known as Grails.
Topics such as Spring Roo and Spring REST receive a thin but good introduction' but then again; they do not deserve more since they are meant to simplify concepts such as project creation and REST client implementations. Do not expect to fully understand these topics by the end of their respective chapters. For example, Spring Roo is kept to a demo form which leads you start Spring Roo and go through a very short sequential introduction to the point where you are left at a starting point, which means, you must perhaps find another book or refer to the Spring Roo online reference to advance further. The online documentation offered by Spring as well as Spring STS are also great resources for exploring this new and cool project.
Spring Batch is introduced as a mere simple concept and no in-depth recipes are shown. The online documentation is a far better venue for this topic. It would have been nice to fuse with the Quartz Scheduler section to exemplify integrated Spring Batch with the Quartz Scheduler.
Quartz scheduling is anemic and virtually unchanged from the previous edition. The Quartz Scheduling framework is very complex and the Spring simplifications are not properly introduced using logical examples. This is perhaps one of the first and most obvious weaknesses in the book which was perhaps acceptable in the first edition but it's detrimental in the second edition. I personally consider Quartz a major scheduling framework and now that Terracotta owns it will receive more enhancements such as grid functionality.
The OSGI section is short. Spring DM is short and outdated. If focuses on Spring DM 1.2.x and the examples are anemic. They merely demonstrate how to power on Spring DM but do not delve deeply into the Spring DM dynamics and completely ignore Spring DM events. Spring DM is a favorite project of mine and I feel it should have received more attention.
For those still in love with EJB, there is a section for you. I will not discuss much about this chapter because there is not much to say. The concept is properly covered and that's it.
In the second edition, the Messaging section has been separated from the EJB joint chapter. This gave the current author more room to explain the reasoning behind Message driven programming and it allowed for more examples with the updated ActiveMQ framework.
The following chapters are the strength of this book.
- Introduction to Spring
- Advanced Spring IoC Container
- Spring AOP and AspectJ Support
- Scripting in Spring
- Spring Security
- Spring Web Flow
- Spring MVC
- Spring REST
- Spring Testing
- Data Access
- Spring in the Enterprise
- Spring Integration
- Spring on the Grid
Overall, I would recommend this book because it serves as a complete reference on what Spring can offer. Some topics will require the reader to seek more documentation; namely, Spring Roo, Spring Batch and Spring Integration. This is natural since those are technologies which require far more documentation, but this book does introduce these topics very well.
In closing, I would recommend reading the electronic version since the paper based book is impossibly thick. The PDF edition of the book is properly indexed and it's a plus if you wish to copy/paste code from it which is natural at times given that this edition did not arrange the examples by chapters.