SpringSource/spring-framework — pull request #14 by cbeams (2012-01-07 01:48:15+00:00)
Title: Introduce (and Review) ScriptEvaluator abstraction

@costin, this PR supersedes your original one at #11 (I don't think it's possible for me to add commits to someone else's PR). I'll close it right after sending this one. Take a look at the "Review" commit 319d8566 to see what I've already updated.

A few open questions:

1. Is the 'arguments' parameter to Jsr233ScriptEvaluator#determineScriptEngine actually necessary? It's not currently used in the implementation, and it's difficult to imagine a use case where a subclass would use arguments to determine which ScriptEngine to use. Perhaps this is an oversight?
1. Can you explain the intention / necessity of the 'runAtStartup' setting in Jsr223ScriptEvaluatorFactoryBean? getObject will be invoked when singletons are initialized anyway -- is it actually important have such an explicit setting to do this in the @PostConstruct method as well?
1. Can you explain a use case where EvaluationPolicy (formerly EvaluationType) would be anything other than ALWAYS? A unit test here would be good. I'm simply not familiar with the "script modification" semantics that are mentioned throughout. It makes sense when imagining someone using a ScriptEvaluator directly, but against the FactoryBean, it doesn't (yet) make sense to me, unless perhaps the FactoryBean is non-singleton scoped.
1. Curiosity mostly, but what was the impetus for this change? Why now?
1. Could you also add and assign to yourself an issue to add reference documentation for this feature?

@jhoeller, could you take a look at the cumulative set of changes for a sanity check, e.g. that this is appropriate for 3.1.1, etc? (You can click on the "Files Changed" tab to see the net result of both my and Costin's commits).

Issue: [SPR-8999](https://jira.springsource.org/browse/SPR-8999)