Is it possible to configure Groovy beans declared with lang namespace or manually with GroovyScriptFactory in such a way, that they use invoke dynamic support?
<lang:groovy id="messenger" script-source="classpath:Messenger.groovy">
I have not found any reliable documentation on this case.
And, does a GroovyClassLoader provided with groovy-all:indy maven artifact uses this feature, or it can be used only with groovy compiler?
In order to activate the invoke-dynamic support, you have to :
groovy.target.indy
to true or the CompilerConfiguration.DEFAULT.getOptimizationOptions().put("indy", true)
This will enable this function for all invocations of the groovy compiler (and Spring will use this option). I don't think there is a way to configure this option through the ScriptEngine
, for only a subset of scripts.
If you use directly a GroovyClassLoader, you can provide this option through the CompilerConfiguration.optimizationOptions.indy
property