English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
We can use many operators in SpEL, such as arithmetic, relational, logical, etc. Many examples of using different operators in SpEL are given.
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(); //Arithmetic Operators 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()); //Logical Operators System.out.println(parser.parseExpression("true and true").getValue()); //Relational Operators System.out.println(parser.parseExpression("'sonoo'.length()==5).getValue()); } }