In this post we are going to talk a little bit about how to integrate Groovy (or another Scripting language like JRuby or BeanShell) within a Spring project. Achiving that is not really complicated, the only thing you need to do is add your Groovy scripts with a special schema within your application context. The example I am going to show you is uploaded to my Github account. You can find it right here.
And what are we going to do?. We are create a simple sample, based in the official Spring documentation you may find here or here too. We are going to write our Spring MVC controller, but thanks to Groovy we are going to be able to redefine our controller redirection with no need to compile our code again.
The example is pretty simple, imaging you have a controller related to a specified url (say home.htm). What we want is changing the page the controller eventually render. So we need to write our code using Groovy.