SPEL運算符

我們可以在SpEL中使用許多運算符,例如算術(shù),關(guān)系,邏輯等。給出了很多在SpEL中使用不同運算符的示例。

在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();
        //算術(shù)運算符
        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());
        //關(guān)系運算符
        System.out.println(parser.parseExpression("'sonoo'.length()==5").getValue());
    }
}
丰满人妻一级特黄a大片,午夜无码免费福利一级,欧美亚洲精品在线,国产婷婷成人久久Av免费高清