Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In this chapter, we covered how to use scripting languages in Java applications and demonstrated how the Spring Framework's support of scripting language can help provide dynamic behavior to the application.
First we discussed JSR-223, the Scripting for the Java Platform API, which was built into JSE 6 and supports the execution of JavaScript out of the box. Then, we introduced Groovy, a popular scripting language within the Java developer communities. We also demonstrated some of its main features when compared to the traditional Java language.
Finally, we discussed the support of scripting languages in the Spring Framework. We saw it in action by designing and implementing a very simple rule engine using Groovy's DSL support. We also discussed how the rule can be modified and have the Spring Framework pick up the changes automatically by using its refreshable bean feature, without the need to compile, package, and deploy the application.