SpEL

 SpelExpressionParser spelExpressionParser = new SpelExpressionParser();

Expression expression = spelExpressionParser.parseExpression("22+44");
System.out.println(expression.getValue());

It can be used like that, In @Value("#{give the expression}")
Expression language is used with classes, variables, methods, constructors, and objects
As well as with char, numeric, operators, keywords and special symbols which returns a value

                                To Call Static Method and Variable inside expression language
T(Class).method(param), T(class).variable
class should be full class path e.g 
T(java.lang.Math).sqrt(25);
T(java.lang.Math).E

                            To Create Objects
new Object(value)

e.g:   @Value("#{new java.lang.String('H')}")

                           Boolean Type in SpEL
@Value("#{8>2}")

Comments

Popular posts from this blog