Here is how to produce class from Groovy script.
File scriptFile = new File("implementation.groovy");
GroovyClassLoader gcl = new GroovyClassLoader();
Class clazz = gcl.parseClass(scriptFile);
Object object = clazz.newInstance();
It is possible to put class object (clazz instance in above example) into cache system to enhance performace.
Warn! You need to watch for your app performance on high trafic system and extend your application cautiously.