Czar
12/18/2019, 7:08 PMval scriptText: String = /* loaded from somewhere, e.g. resource or even http request */
val shell = GroovyShell()
val script = shell.parse(scriptText).run()
This basically allows to load scripts into a running application and allows the script to seemlessly interface with all classes and instances in the running application.
We currently use this mechanism to load kind of lightweight plugins into our spring boot app, even autowiring works:
val script = shell.parse(scriptText).let(autowireBeanFactory::autowireBean).run()