Search code examples
javaspringspring-mvcspring-securityspring-el

List of Spring EL Variables?


Spring EL supports a some predefined variables

  • {#systemProperties. ... }
  • {#systemEnvironment. ... }
  • {#request. ...}
  • {#session. ...}

The first two once are documented in the Spring Reference: chapter 6. Spring Expression Language (SpEL). The two others are not mentioned in the Spring Reference (or I did not found them.) (I found them in this slides, as well as its usage in spring social and this question).

So my question is: is there a more or less complete list of predefined spring-el variables?

I guess that some of this predefined variables are not defined by spring core itself, but by "activating" of some modules like spring-mvc. So I am interested in the the variables that are available in a more or less common spring + jpa + mvc + security application.


Solution

  • I can not answer your root question but I may give you a hint.

    There are some predefined beans registered at start up of your application context but which depends on the context type you are using.

    Commonly, systemProperties and systemEnvironment are present. Loading Spring within a web application, you will also get servletContext, contextParameters and contextAttributes. I assume, request and session are related to a web application context as well.

    I discovered this during debugging of my application which uses Spring 3.0.6RELEASE. A good starting point is SpringBeanELResolver.getValue() method.