Class GroovyScriptExecutingMessageProcessor
java.lang.Object
org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor<Object>
org.springframework.integration.groovy.GroovyScriptExecutingMessageProcessor
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.InitializingBean,org.springframework.integration.handler.MessageProcessor<Object>
public class GroovyScriptExecutingMessageProcessor
extends org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor<Object>
implements org.springframework.beans.factory.InitializingBean
The
MessageProcessor implementation
to evaluate Groovy scripts.- Since:
- 2.0
-
Constructor Summary
ConstructorsConstructorDescriptionGroovyScriptExecutingMessageProcessor(org.springframework.scripting.ScriptSource scriptSource) Create a processor for the givenScriptSourcethat will use a DefaultScriptVariableGenerator.GroovyScriptExecutingMessageProcessor(org.springframework.scripting.ScriptSource scriptSource, org.springframework.integration.scripting.ScriptVariableGenerator scriptVariableGenerator) Create a processor for the givenScriptSourcethat will use the provided ScriptVariableGenerator. -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected ObjectexecuteScript(org.springframework.scripting.ScriptSource scriptSource, Map<String, Object> variables) protected org.springframework.scripting.ScriptSourcegetScriptSource(org.springframework.messaging.Message<?> message) voidsetCompilerConfiguration(org.codehaus.groovy.control.CompilerConfiguration compilerConfiguration) Specify theCompilerConfigurationoptions to customize the Groovy script compilation.voidsetCompileStatic(boolean compileStatic) Specify thebooleanflag to indicate if theGroovyClassLoader's compiler should be customised for theCompileStatichint for the provided script.voidsetCustomizer(org.springframework.scripting.groovy.GroovyObjectCustomizer customizer) Sets aGroovyObjectCustomizerfor this processor.Methods inherited from class org.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor
getBeanClassLoader, getBeanFactory, getScriptVariableGenerator, processMessage, setBeanClassLoader, setBeanFactory
-
Constructor Details
-
GroovyScriptExecutingMessageProcessor
public GroovyScriptExecutingMessageProcessor(org.springframework.scripting.ScriptSource scriptSource) Create a processor for the givenScriptSourcethat will use a DefaultScriptVariableGenerator.- Parameters:
scriptSource- The script source.
-
GroovyScriptExecutingMessageProcessor
public GroovyScriptExecutingMessageProcessor(org.springframework.scripting.ScriptSource scriptSource, org.springframework.integration.scripting.ScriptVariableGenerator scriptVariableGenerator) Create a processor for the givenScriptSourcethat will use the provided ScriptVariableGenerator.- Parameters:
scriptSource- The script source.scriptVariableGenerator- The variable generator.
-
-
Method Details
-
setCustomizer
public void setCustomizer(org.springframework.scripting.groovy.GroovyObjectCustomizer customizer) Sets aGroovyObjectCustomizerfor this processor.- Parameters:
customizer- The customizer.
-
setCompileStatic
public void setCompileStatic(boolean compileStatic) Specify thebooleanflag to indicate if theGroovyClassLoader's compiler should be customised for theCompileStatichint for the provided script.More compiler options can be provided via
setCompilerConfiguration(CompilerConfiguration)overriding this flag.- Parameters:
compileStatic- the compile-staticbooleanflag.- Since:
- 4.3
- See Also:
-
CompileStatic
-
setCompilerConfiguration
public void setCompilerConfiguration(org.codehaus.groovy.control.CompilerConfiguration compilerConfiguration) Specify theCompilerConfigurationoptions to customize the Groovy script compilation. For example theCompileStaticandImportCustomizerare the most popular options.- Parameters:
compilerConfiguration- the Groovy script compiler options to use.- Since:
- 4.3
- See Also:
-
CompileStaticGroovyClassLoader
-
getScriptSource
protected org.springframework.scripting.ScriptSource getScriptSource(org.springframework.messaging.Message<?> message) - Specified by:
getScriptSourcein classorg.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor<Object>
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
executeScript
protected Object executeScript(org.springframework.scripting.ScriptSource scriptSource, Map<String, Object> variables) - Specified by:
executeScriptin classorg.springframework.integration.scripting.AbstractScriptExecutingMessageProcessor<Object>
-