English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Wir können in SpEL viele Operatoren verwenden, wie zum Beispiel arithmetische, relationale und logische Operatoren. Es gibt viele Beispiele für die Verwendung verschiedener Operatoren 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(); //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()); } }