Spring in Action, Manning
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
|
Contents |
C# Online.NET Book Review
Spring sprang from code published in Expert One-on-One J2EE Design and Development by Rod Johnson (Wrox, 2002). That book was—indeed—a breath of fresh air. It reexamined the entire Java approach to enterprise development. Spring is a layered Java / J2EE application framework based on a principle called Inversion of Control. And, it does not use the much maligned Enterprise JavaBeans (EJB). Today, Spring has displaced Struts as the top Java application framework—although Struts is alive, well, and evolving.
The free Spring reference documentation is up to a very high standard. And, although it is far more thorough, the reference material just does not read like a good introductory text.
Spring in Action is an introduction to Spring, an overview of its place among various other open source enterprise tools and technologies, and then a tutorial on how to hook things together both within Spring and with the outside world. The tripartite book covers Spring fundamentals, Spring for the Web layer, and Spring for the business layer. Thus, it covers a great range of disparate topics related only by the Spring connection. Accordingly, it does not go into great detail on Spring itself, especially advanced Spring features.
The authors' style is varied and palatable—ranging from conversational to humorous to informative. They have done a good job both in organizing the material and in devising examples—including a sample student registration system.
The ideal reader for this book is a Java enterprise developer who has already fought some of the losing battles which led to the development of Spring. Only someone with that background will grasp immediately the power and elegance of the Sping approach. To introduce the Spring framework to a complete novice would take a lot more backfilling and handholding than this book provides. In fact, this book demonstrates a constant respect for the caliber of its audience.
All of the source code examples are in the Java language. There have been reports that the sample application downloaded from the Web site is out of synch with the book—making it difficult to work through the sample application. And, reports that several of the examples in the book simply do not work or that they are not well designed. Also, there seem to be problems with the build and other things which a novice Java developer may spend valuable time trying to rectify. All of these issues will be more troubling to a beginner than to a seasoned veteran.
Bottom line
Spring in Action is a great introduction to and overview of Spring for practicing enterprise Java developers.
Other books in this series
From the back cover
Spring is a fresh breeze blowing over the Java landscape. Based on a design principle called Inversion of Control, Spring is a powerful but lightweight J2EE framework that does not require the use of EJBs. Spring greatly reduces the complexity of using interfaces, and speeds and simplifies your application development. You get the power and robust features of EJB and get to keep the simplicity of the non-enterprise JavaBean.
Spring in Action introduces you to the ideas behind Spring and then quickly launches into a hands-on exploration of the framework. Combining short code snippets and an ongoing example developed throughout the book, it shows you how to build simple and efficient J2EE applications. You will see how to solve persistence problems using the leading open-source tools, and also how to integrate your application with the most popular web frameworks. You will learn how to use Spring to manage the bulk of your infrastructure code so you can focus on what really matters???your critical business needs.
What's inside
- Persistence using Hibernate, JDO, iBatis, OJB, and JDBC
- Declarative transactions and transaction management
- Integration with web frameworks: Struts, WebWork, Tapestry, Velocity
- Accessing J2EE services such as JMS and EJB
- Addressing cross-cutting concerns with AOP
- Enterprise applications best practices
About the author(s)
Craig Walls is a software developer with over 10 years' experience and co-author of XDoclet in Action. He has sucessfully implemented a number of Spring applications. Craig lives in Denton, Texas.
Ryan Breidenbach, an avid supporter of open source Java technologies, has been developing Java web applications for the past five years. He lives in Coppell, Texas.
Table of contents (abbreviated)
Part 1 Spring essentials
1 A Spring jump start
2 Wiring beans
3 Creating aspects
Part 2 Spring in the business layer
4 Hitting the database
5 Managing transactions
6 Remoting
7 Accessing enterprise services
Part 3 Spring in the web layer
8 Building the web layer
9 View layer alternatives
10 Working with other web frameworks
11 Securing Spring applications
A Spring setup
B Spring-related projects
Preface
Software developers need to have a number of traits in order to practice their craft well. First, they must be good analytical thinkers and problem solvers. A developer?s primary role is to create software that solves business problems. This requires analyzing customer needs and coming up with successful, creative solutions.
They also need to be curious. Developments in the software industry are moving targets, always evolving. New frameworks, new techniques, new languages, and new methodologies are constantly emerging. Each one is a new tool that needs to be mastered and added to the toolbox, allowing the developer to do his or her job better and faster.
Then there is the most cherished trait of all, "laziness." The kind of laziness that motivates developers to work hard to seek out solutions with the least amount of effort. It was with curiosity, a good dose of "laziness," and all the analytical abilities we could muster that the two of us struck out together four years ago to find new ways to develop software.
This was the time when open source software was reaching critical mass in the Java community. Tons of open source frameworks were blossoming on the Java landscape. In order to decide to adopt one, it had to hit the sweet spot of our needs—it had to do 80% of what we needed right out of the box. And for any functionality that was not right out of the box, the framework needed to be easily extendible so that functionality too would be included. Extending didn?t mean kludging in some hack that was so ugly you felt dirty afterwards—it meant extending in an elegant fashion. That wasn?t too much to ask, right?
The first of these frameworks that gained immediate adoption on our team was Ant. From the get-go, we could tell that Ant had been created by another developer who knew our pain in building Java applications. From that moment on, no more javac. No more CLASSPATH. All this with a straightforward (albeit sometimes verbose) XML configuration. Huzzah! Life (and builds) just got easier.
As we went along, we began adopting more and more tools. Eclipse became our IDE of choice. Log4J became our (and everybody else?s) default logging toolkit. And Lucene supplanted our commercial search solution. Each of these tools met our criteria of filling a need while being easy to use, understand, and extend.
But something was lacking. These great tools were designed to help develop software, like Ant and Eclipse, or to serve a very specific application need, like searching in the case of Lucene and logging for Log4J. None of them addressed the needs at the heart of enterprise applications: persistence, transactions, and integration with other enterprise resources.
That all changed in the last year or so when we discovered the remarkable one-two enterprise punch of Spring and Hibernate. Between these two frameworks nearly all of our middle- and data-tier needs were met.
We first adopted Hibernate. It was the most intuitive and feature-rich object/relational mapping tool out there. But it was by adopting Spring that we really got our code to look good. With Spring?s inversion of control, we were able to get rid of all our custom factories and configurers. In fact, that is the reason we first integrated Spring into our applications. Its wiring allowed us to streamline our application configurations and move away from homegrown solutions. (Hey, every developer likes writing his own framework. But sometimes you just have to let go!)
We quickly discovered a nice bonus: Spring also provided very easy integration with Hibernate. This allowed us to ditch our custom Hibernate integration classes and use Spring?s support instead. In turn, this led us directly to Spring?s support for transparent persistence.
Look closely and you will see a pattern here. The more we used Spring, the more we discovered new features. And each feature we discovered was a pleasure to work with. Its web MVC framework worked nicely in a few applications. Its AOP support has been helpful in several places, primarily security. The JDBC support was quite nice for some smaller programs. Oh yeah, we also use it for scheduling. And JNDI access. And email integration. When it comes to hitting development sweet spots, Spring knocks the ball out of the park.
We liked Spring so much, we decided somebody should write a book about it. Fortunately, one of us had already written a book for Manning and knew how to go about doing this sort of thing. Soon that "somebody who should write a book" became us. In taking on this project we are trying to spread the gospel of Spring. The Spring framework has been nothing but a joy for us to work with—we predict it will be the same for you. And, we hope this book will be a pleasant vehicle for you to get to that point.