scala - Scala 中是否有 GroovyScriptEngine 和 GroovyClassLoader 之类的东西?

标签 scala groovy scripting classloader

我注意到 scala 符合 jsr 223 https://issues.scala-lang.org/browse/SI-874 ...但是它能够做像 GroovyScriptEngine 这样的事情吗?我考虑为我们的产品添加 scala 脚本支持,以便开发人员可以编写从 Java 应用程序加载的小型应用程序/组件/类(理想情况下可以重新加载)。我将 GroovyScriptEngine 用于 groovy 应用程序/组件/类,但我在 Scala 中找不到类似的东西。

基本上,我需要为它提供一个包含 Scala 内容的目录,它会加载所有可访问(或至少一个)Java 应用程序的 Scala 类。

你能给我一些指点吗?这是我们使用 Scala 的唯一方法。

最佳答案

Scala Script Engine

This library dynamically compiles scala source files and loads them as classes. Changed scala files will be recompiled and the changed class with be loaded. Multiple source paths are supported as well as compilation class path and class loading class paths (so that the scripts can load extra libraries).

Classpath detection can be automatic (effectively using the classpath of the caller) or manual.

Different compilation and refreshing strategies are provided to suit various purposes.

关于scala - Scala 中是否有 GroovyScriptEngine 和 GroovyClassLoader 之类的东西?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16122398/

相关文章:

引用成员类型的 Scala 宏

Scala 类型推断限制

python - 如何从 Spark SQL 查询 [PySpark] 获取表名?

Linux命令在写入文件之前检测命令

scala - 无法从 Spark 连接到 S3 - AmazonS3Exception 状态代码 : 400

java - 从数据库发送电子邮件的工具

gradle - Gradle的Groovy语法:项目

java - 终止实例永远不会返回终止状态 aws sdk

linux - 获取登录用户列表的脚本

javascript - CSS 类未在节点中应用