Interview Questions: Spring Expression Language
June 12, 2013
Qns-1: What are the features of Spring Expression Language? |
Ans: Find the few features of Spring Expression Language Literal expressions Boolean and relational operators Regular expressions Class expressions Accessing properties, arrays, lists, maps Method invocation Relational operators Assignment Calling constructors |
Qns-2: What classes are used for Expression Evaluation in Spring? |
Ans: Find the code snippet for expression evaluation.
ExpressionParser expPar = new SpelExpressionParser(); Expression exp = expPar.parseExpression("'Hi, My Name is Ram'"); String message = (String) exp.getValue(); |
Qns-3: What is the role of EvaluationContext in Spring? |
Ans: EvaluationContext helps to resolve properties, methods, fields in an expression. EvaluationContext also helps in type conversion. |
Qns-4: How many ways expression supports to define bean definitions? |
Expression supports in both way a. XML based configuration b. Annotation-based configuration |
Qns-5: What is the role of #this and #root variables in Spring Expression? |
Ans: #this refers to the current evaluation object. #root refers to the root context object. |