Announcement Announcement Module
Collapse
No announcement yet.
SpEL and custom functions Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SpEL and custom functions

    I think I know the answer to this, but I need to ask anyway...

    It seems that in order to register a custom function in SpEL that I must have access to the evaluation context. And from what I can tell, the only way I can get access to the evaluation context is when I'm working with SpEL programmatically.

    I've scoured the source code for Spring 3.0.0.RC1 and from what I can tell, there's no way (no obvious way) that I can register a custom function in SpEL when using it for wiring bean property values. Programmatic SpEL, no problem. But using SpEL with bean wiring I can't use custom functions.

    Am I right? Or am I missing something?

    Also, while I'm asking about SpEL...When using SpEL for wiring bean properties I get access to any bean in the Spring context as well as systemEnvironment and systemProperties (because they end up as beans in the Spring context). I also get request and session assuming that I'm using it with properly scoped beans in a web application. Aside from systemEnvironment, systemProperties, request, session, and #this, are there any other "built-in" things that I get access to?

    Just want to make sure I'm not overlooking something.

  • #2
    habuma, have you worked this out yet? I have the same problem.

    Comment


    • #3
      Would you please let me know where I can find documentation on systemEnvironment? I can't find any reference to this in Spring Framework Reference. I would also like to know the list of properties that may be access through systemProperties.

      Comment


      • #4
        I hope the below example will help you.

        StandardEvaluationContext.registerFunction registers user defined function to work as spring expression language. To do this creates your own class and methods that need to be register. In our example we are defining a method that take input as string and return the length + 10. Find the example below.

        http://www.concretepage.com/spring/r...n-language.php

        Comment

        Working...
        X