Java Reference
In-Depth Information
1.3. Java use cases and how Groovy helps
The examples I've discussed so far are all code-level simplifications. They're very helpful,
but I can do more than that. Groovy developers work on the same sorts of problems that
Java developers do, so many higher-level abstractions have been created to make address-
ing those problems easier.
In this topic I'm also going to survey the various types of problems that Java developers
face on a regular basis, from accessing and implementing web services to using object-
relational mapping tools to improving your build process. In each case I'll examine how
adding Groovy can make your life easier as a developer.
Here's a list of some of the areas I'll discuss as we go along, and I'll give you a brief
idea of how Groovy will help. This will also provide a lightweight survey of the upcoming
chapters.
1.3.1. Spring framework support for Groovy
One of the most successful open source projects in the Java industry today is the Spring
framework. It's the Swiss Army chainsaw of projects; it's pervasive throughout the Java
world and has tools for practically every purpose.
No one is ever going to suggest rewriting Spring in Groovy. It works fine in Java as it
is. Nor is there any need to “port” it to Groovy. As far as Spring is concerned, compiled
Groovy classes are just another set of bytecodes. Groovy can use Spring as though it's just
another library.
The developers of Spring, however, are well aware of Groovy and built in special cap-
abilities for working with it. Spring bean files can contain inline scripted Groovy beans.
Spring also allows you to deploy Groovy source code, rather than compiled versions, as so-
called refreshable beans. Spring periodically checks the source code of refreshable beans
for changes and, if it finds any, rebuilds them and uses the updated versions. This is a very
powerful capability, as chapter 7 on working with Spring will show.
Search WWH ::




Custom Search