Easy learning with example program codes

spring spel tutorial

Spring SpEL:

The SpEL stands for Spring Expression Language. It is a powerful expression language which supports querying and manipulating an object graph at the bean creation time or run time. It is similar to other expression languages like JSP EL, OGNL, MVEL and JBoss EL etc with some additional features like method invocation and basic string templating functionality.

Note: Spring expressions are available with both XML and annotation type bean configuration metadata. For using annotation type bean configuration metadata we use @Component and @Value.


#{ expression }

Some uses of Spring SpEL:

1. It can be used to inject a bean or a bean property in another bean.
2. It can be used to invoke a bean method in another bean.
3. It can be used to execute any standard mathematical, logical or relational operations.
4. It can be used to perform conditional checking with ternary operator.
5. It can be used to get the elements of a Map or a List.

Spring SpEL interfaces and classes:

1. Expression interface
2. SpelExpression class
3. ExpressionParser interface
4. SpelExpressionParser class
5. EvaluationContext interface
6. StandardEvaluationContext class

Spring SpEL tutorial:


Copyright © 2018 CodesJava Protection Status SiteMap