Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Spring Expression Language (SpEL) and Unified Expression Language (UEL)

what are the differences between the Spring Expression Language (SpEL) and the Unified Expression Language (UEL)?

The official Spring Documentation says:

"The language syntax is similar to Unified EL but offers additional features, most notably method invocation and basic string templating functionality." (see http://static.springsource.org/spring/docs/current/spring-framework-reference/html/expressions.html)

What exactly are the differences regarding method invocation?

Are there some more differences?

Thx, Matthias

like image 907
hueller Avatar asked Oct 06 '22 19:10

hueller


1 Answers

Unified EL is a real template language, it offers no way to call methods. The language only allows you to access properties of Java beans and not their methods. EL 2.2 allows you to call methods, so this argument is no longer valid.

Spring El is a powerfull language as it allows you to call methods and constructors, make assignments and filter collections. If you use Spring EL in your JSP views, using the spring:eval tag, you also automatically get the benefit of the spring converters/formatters. It is a great tool, but is should be used with care because it makes it very tempting to put all kinds of application logic in your views.

Besides the JSP views Spring EL can be used in other parts of the Spring framework like in security expressions with the @PreAuthorize annotation.

like image 78
Jasper Krijgsman Avatar answered Oct 10 '22 03:10

Jasper Krijgsman