We can use many operators in Spring Expression Language such as arithmetic, relational, logical etc. There are given a lot of examples of using different operators in SpEL.
Examples of using operators in SPEL
- import org.springframework.expression.ExpressionParser;
- import org.springframework.expression.spel.standard.SpelExpressionParser;
-
-
- public class Test {
- public static void main(String[] args) {
- ExpressionParser parser = new SpelExpressionParser();
-
-
- System.out.println(parser.parseExpression("'Welcome SPEL'+'!'").getValue());
- System.out.println(parser.parseExpression("10 * 10/2").getValue());
- System.out.println(parser.parseExpression("'Today is: '+ new java.util.Date()").getValue());
-
-
- System.out.println(parser.parseExpression("true and true").getValue());
-
-
- System.out.println(parser.parseExpression("'sonoo'.length()==5").getValue());
- }
- }
No comments:
Post a Comment
Note: only a member of this blog may post a comment.