Skip to content
Advertisement

Should I use Bean Scripting Framework or JSR 223 javax.script ?

I was reading the groovy doc about integrating groovy into applications.

From the paragraph 2. Bean Scripting Framework I can read

The Bean Scripting Framework is an attempt to create an API to allow calling scripting languages from Java. It hasn’t been updated for long and abandoned in favor of the standard JSR-223 API.

From the paragraph 3. JSR 223 javax.script API I can read

SR-223 is a standard API for calling scripting frameworks in Java. … Groovy provides its own richer integration mechanisms, and if you don’t plan to use multiple languages in the same application, it is recommended that you use the Groovy integration mechanisms instead of the limited JSR-223 API.

Is the Bean Scripting Framework the Groovy integration mechanisms from the second quote ? If so it seems there is an infinite loop. Did I misunderstand something ? Is this a doc problem ? Which one should I use ?

Advertisement

Answer

Is the Bean Scripting Framework the Groovy integration mechanisms from the second quote ?

No, this means one of GroovyScriptingEngine, GroovyShell, Eval, GroovyClassLoader or direct usage of CompilationUnit ( the compiler core basically). Which one to use depends on your use case. For most cases GroovyShell works out.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement