Java Reference
In-Depth Information
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, in-
cluding aspects. It then shows Spring capabilities unique to dynamic languages, like re-
freshable 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 work-
ing 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 specific-
ation. 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.
The last chapter in this section is about web application development. Chapter 10 starts
with a nice example of Groovy metaprogramming using categories. Specifically, the Ser-
vletCategory class is presented as an example of what can be done quickly and easily
with Groovy. Next comes a discussion of groovlets, which are Groovy scripts executed
through a servlet that make it easy to get a simple application running. The chapter con-
cludes with a demonstration of the Grails framework as a beautiful combination of Groovy
DSLs that combine and configure Spring/Hibernate-based web applications.
 
Search WWH ::




Custom Search