Pages Navigation Menu

Coding is much easier than you think

Basics of Spring Expression Language (SpEL)


 
The Spring Expression Language (SpEL for short) is a powerful expression language that supports querying and manipulating an object graph at runtime and can work with all the spring framework products.There are several other Java expression languages like, OGNL, MVEL, and JBoss EL, etc. Still, the Spring Expression Language was created to provide the Spring community with a single well supported expression language that can used across all the products in the Spring portfolio. The language syntax is similar to Unified EL but offers additional features, most notably method invocation and basic string templating functionality.

Though spEL works as the foundation for expression language within spring, it is still not tied to the spring framework. Thus spEL works independently without depending on the spring framework.
 

The expression language supports the following functionality

  • Literal expressions
  • Boolean and relational operators
  • Regular expressions
  • Class expressions
  • Accessing properties, arrays, lists, maps
  • Method invocation
  • Relational operators
  • Assignment
  • Calling constructors
  • Bean references
  • Array construction
  • Inline lists
  • Ternary operator
  • Variables
  • User defined functions
  • Collection projection
  • Collection selection
  • Templated expressions