Chapter 14. Spring and transactions
In this chapter
- Introducing the Spring Framework
- Making the most of Spring
- Mastering transactions
After plumbing the depths of GORM and Hibernate, it’s time to move back up the abstraction hierarchy and look at the application infrastructure. GORM is wonderful as a database abstraction layer, and you can work some magic with controllers and GSPs, but just as a vertebrate needs a backbone to hold all its appendages together, so too does an application.
Fortunately, Grails is built around a tried and tested framework that will help you grow your application: Spring. We’ve mentioned it in passing a few times, and it tends to remain invisible if your application remains fairly simple. The trouble is, if it stays invisible, you’ll miss out on powerful tools in your armory. We can’t have that, so this chapter will explain some of the basics of the framework and how Grails allows you to interact with it directly.
After that, we’ll look at a feature that will come in handy after all the talk of databases in the previous chapter: transactions. Although not part of the core Spring framework, Spring’s transaction support is instrumental in building reliable, data-oriented applications. It’s an important topic that deserves, and receives, thorough treatment.
Let’s find out what Spring can do for you.
Note
If you’re already a Spring aficionado, we suggest you skim the next section and give the introduction on services a brief once over.