spring-framework / org.springframework.scripting.groovy / GroovyScriptFactory / <init>

<init>

GroovyScriptFactory(scriptSourceLocator: String)

Create a new GroovyScriptFactory for the given script source.

We don't need to specify script interfaces here, since a Groovy script defines its Java interfaces itself.

Parameters

scriptSourceLocator - a locator that points to the source of the script. Interpreted by the post-processor that actually creates the script.

GroovyScriptFactory(scriptSourceLocator: String, @Nullable groovyObjectCustomizer: GroovyObjectCustomizer)

Create a new GroovyScriptFactory for the given script source, specifying a strategy interface that can create a custom MetaClass to supply missing methods and otherwise change the behavior of the object.

Parameters

scriptSourceLocator - a locator that points to the source of the script. Interpreted by the post-processor that actually creates the script.

groovyObjectCustomizer - a customizer that can set a custom metaclass or make other changes to the GroovyObject created by this factory (may be null)

See Also
GroovyObjectCustomizer#customize

GroovyScriptFactory(scriptSourceLocator: String, @Nullable compilerConfiguration: CompilerConfiguration)

Create a new GroovyScriptFactory for the given script source, specifying a strategy interface that can create a custom MetaClass to supply missing methods and otherwise change the behavior of the object.

Parameters

scriptSourceLocator - a locator that points to the source of the script. Interpreted by the post-processor that actually creates the script.

compilerConfiguration - a custom compiler configuration to be applied to the GroovyClassLoader (may be null)

Since
4.3.3

See Also
GroovyClassLoader#GroovyClassLoader(ClassLoader, CompilerConfiguration)

GroovyScriptFactory(scriptSourceLocator: String, vararg compilationCustomizers: CompilationCustomizer)

Create a new GroovyScriptFactory for the given script source, specifying a strategy interface that can customize Groovy's compilation process within the underlying GroovyClassLoader.

Parameters

scriptSourceLocator - a locator that points to the source of the script. Interpreted by the post-processor that actually creates the script.

compilationCustomizers - one or more customizers to be applied to the GroovyClassLoader compiler configuration

Since
4.3.3

See Also
CompilerConfiguration#addCompilationCustomizersorg.codehaus.groovy.control.customizers.ImportCustomizer