Class StandardScriptFactory

java.lang.Object
org.springframework.scripting.support.StandardScriptFactory
All Implemented Interfaces:
Aware, BeanClassLoaderAware, ScriptFactory

public class StandardScriptFactory extends Object implements ScriptFactory, BeanClassLoaderAware
ScriptFactory implementation based on the JSR-223 script engine abstraction (as included in Java). Supports JavaScript, Groovy, JRuby, and other JSR-223 compliant engines.

Typically used in combination with a ScriptFactoryPostProcessor; see the latter's javadoc for a configuration example.

Since:
4.2
Author:
Juergen Hoeller
See Also:
  • Constructor Details

    • StandardScriptFactory

      public StandardScriptFactory(String scriptSourceLocator)
      Create a new StandardScriptFactory for the given script source.
      Parameters:
      scriptSourceLocator - a locator that points to the source of the script. Interpreted by the post-processor that actually creates the script.
    • StandardScriptFactory

      public StandardScriptFactory(String scriptSourceLocator, Class<?>... scriptInterfaces)
      Create a new StandardScriptFactory for the given script source.
      Parameters:
      scriptSourceLocator - a locator that points to the source of the script. Interpreted by the post-processor that actually creates the script.
      scriptInterfaces - the Java interfaces that the scripted object is supposed to implement
    • StandardScriptFactory

      public StandardScriptFactory(String scriptEngineName, String scriptSourceLocator)
      Create a new StandardScriptFactory for the given script source.
      Parameters:
      scriptEngineName - the name of the JSR-223 ScriptEngine to use (explicitly given instead of inferred from the script source)
      scriptSourceLocator - a locator that points to the source of the script. Interpreted by the post-processor that actually creates the script.
    • StandardScriptFactory

      public StandardScriptFactory(@Nullable String scriptEngineName, String scriptSourceLocator, @Nullable Class<?>... scriptInterfaces)
      Create a new StandardScriptFactory for the given script source.
      Parameters:
      scriptEngineName - the name of the JSR-223 ScriptEngine to use (explicitly given instead of inferred from the script source)
      scriptSourceLocator - a locator that points to the source of the script. Interpreted by the post-processor that actually creates the script.
      scriptInterfaces - the Java interfaces that the scripted object is supposed to implement
  • Method Details