public void TestScenario_RegisteringJavaMethodsAsFunctionsAndCallingThem() { try { // Create a parser var parser = new SpelExpressionParser(); // Use the standard evaluation context var ctx = new StandardEvaluationContext(); ctx.RegisterFunction("Repeat", typeof(ExpressionLanguageScenarioTests).GetMethod("Repeat", new Type[] { typeof(string) })); var expr = parser.ParseRaw("#Repeat('hello')"); var value = expr.GetValue(ctx); Assert.Equal("hellohello", value); } catch (EvaluationException ex) { throw new SystemException(ex.Message, ex); } catch (ParseException ex) { throw new SystemException(ex.Message, ex); } }