We were using ExpressionEvaluationUtils
(Deprecated) class to evaluate expression when using Spring 3.2.8. Now we have migrated our product from Spring 3 to Spring 4.
final Object argument = ExpressionEvaluationUtils.evaluate("argument", stringArray[0], this.pageContext);
In Spring 4, they have removed this util file. I have search some alternative util/service but didn't get any result.
Can somebody tell me what is the alternative of ExpressionEvaluationUtils class?
You can use:
Spring ExpressionFactory
:
ELContext elContext = pageContext.getELContext();
JspFactory jf = JspFactory.getDefaultFactory();
JspApplicationContext jac = jf
.getJspApplicationContext(pageContext.getServletContext());
ExpressionFactory ef = jac.getExpressionFactory();
ValueExpression val = ef.createValueExpression(elContext, "your expression", resultClass);