Part 3. Groovy in the real world
In part 3, “Groovy in the real world,” I try to address the sorts of challenges Java developers face on a regular basis.
I start with the Spring framework, which is probably the most commonly used open source project in the Java world. Spring and Groovy are old friends and work together beautifully. Chapter 7 shows how to use Groovy classes as Spring beans anywhere in your system, including aspects. It then shows Spring capabilities unique to dynamic languages, like refreshable beans, inline scripted beans, and the BeanBuilder class from Grails.
Chapter 8 covers Groovy interactions with persistent storage. Groovy includes a very useful façade over JDBC known as the groovy.sql.Sql class, which is effective when working with relational databases. The chapter also provides an example of working with the GMongo project, a Groovy wrapper around the Java API for working with MongoDB. This is a typical Groovy idiom—taking a Java library and making it easier to use. Finally, the chapter discusses many of the issues associated with GORM, the Grails Object Relational Mapping layer from Grails, which is probably the most common domain-specific language in Groovy used today.
Chapter 9 focuses on RESTful web services, with an emphasis on the JAX-RS 2.0 specification. Most of the JAX-RS capabilities operate the same way under Groovy as under Java, but examples are provided to show how to work with hypermedia applications as well.