我的 Java 应用程序需要一种脚本语言。
我倾向于 Groovy,因为它的工具和语言似乎最适合这项工作。
我的困惑来自于整个 JSR-223 与这一切的关系。创建引擎时我应该关心使用特定的 JSR-223 接口(interface)吗?
例如,我们需要远程存储脚本,并能够触发我们的应用程序按需重新加载它们。 GroovyScriptEngine似乎正是我们想要使用的。
但是,this页面讨论了根据 JSR-223 规范创建 Groovy 引擎。这个接口(interface)的局限性要大得多,并且缺乏我们需要的功能,无需构建额外的代码。
JSR-223 如何适应这一切?我应该关心 JSR-223 接口(interface)的使用吗?为什么?
最佳答案
来自Groovy documentation on JSR 223 :
Groovy has many mechanisms for integration with Java, some of which provider richer options than available with JSR 223 (e.g. greater configurability and more security control). JSR 223 is recommended when you need to keep the choice of language used flexible and you don't require integration mechanisms not supported by JSR-223.
关于java - JSR-223 和 Groovy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5274052/