ThymeLeaf newb question here: I would like to register a custom SpEL utility object to provide some custom formatting. The Spring EL documentation says that I should use StandardEvaluationContext.registerFunction() to do this, which is great and all, but I want this to be available for use in all SpEL functions in my ThymeLeaf templates. I figure that this is done in the servlet context XML, but I have no clue how to go about it and I can't find ThymeLeaf documentation that explains how to do it.
StandardEvaluationContext.registerFunction()
is used to assign an identifier with a method and then use it to call that method from your SpEL expressions.
But Spring EL also allows you to call methods on any objects in the context. So if all you need is to make some helper object methods accessible for your SpringEL expressions to call, all you need to do is just put an instance of that helper class to the evaluation context.