Skip to content

Add a ScriptEngine factory to ScriptTemplateConfigurer #23258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kl opened this issue Jul 9, 2019 · 0 comments
Closed

Add a ScriptEngine factory to ScriptTemplateConfigurer #23258

kl opened this issue Jul 9, 2019 · 0 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@kl
Copy link

kl commented Jul 9, 2019

I'm using a the Graal.js engine with ScriptTemplateConfigurer with setSharedEngine(false) to enable thread safety.

Graal.js needs to be configured in order to enable Java interop, for example like this:

ScriptEngine engine = new ScriptEngineManager().getEngineByName("graal.js");
Bindings bindings = engine.getBindings(ScriptContext.ENGINE_SCOPE);
bindings.put("polyglot.js.allowHostAccess", true);
bindings.put("polyglot.js.allowHostClassLookup", true);

The problem is that it's not possible to create an engine instance, configure it and assign it to the ScriptTemplateConfigurer if setSharedEngine is false. In that case you can only set the engine name.

Would it be possible to add a ScriptEngine factory method to ScriptTemplateConfigurer so that it's possible to configure the thread local engine instances?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 9, 2019
@sdeleuze sdeleuze self-assigned this Jul 9, 2019
@sdeleuze sdeleuze added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jul 9, 2019
@sdeleuze sdeleuze added this to the 5.2 RC1 milestone Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants