Chapter 16. Integrating Groovy

 

This chapter covers

  • Embedding Groovy in Java projects
  • Securing user-defined scripts
  • Customizing the runtime context

In the programming-language world, one rule of survival is simple: dance or die. It is not enough to make a beautiful language. You must also make it easy for programs written in your beautiful language to interact with programs written in other languages.

Simon Peyton Jones

One of the biggest advantages of Groovy (even one of the reasons for its inception) is that it integrates natively with Java because both languages run on the same platform and for the most part share the same commonly used data structures like lists and maps. It’s important to understand what makes Groovy such an attractive option when you need to embed a scripting language in your application.

From a corporate perspective, it makes sense to build on the same platform that most of your projects are already running on. This protects the investment in skills, experience, and technology, mitigating risk and thus costs.

16.1. Prelude to integration

16.2. Evaluating expressions and scripts with GroovyShell

16.3. Using the Groovy script engine

16.4. Working with the GroovyClassLoader

16.5. Spring integration

16.6. Riding Mustang and JSR-223

16.7. Mastering CompilerConfiguration

16.8. Choosing an integration mechanism

16.9. Summary