Spring Certified Professional 2023 · Free Practice Question Easy
Question 13
SpEL expressions begin with the # symbol and are wrapped in braces: #{expression}.
Properties can be referenced in a similar fashion, starting with which symbol and wrapped in braces: X{property.name} , X being the symbol?
-
A
$
-
B
!
-
C
@
-
D
#
Reveal correct answer
Correct answer: A
Explanation
SpEL expressions begin with the # symbol and are wrapped in braces: #{expression}.
Properties can be referenced in a similar fashion, starting with a $ symbol and wrapped in braces: ${property.name}.
Property placeholders cannot contain SpEL expressions, but expressions can contain property references:
- #{${someProperty} + 2}
In the example above, assume someProperty has value 2, so the resulting expression would be 2 + 2, which would be evaluated to 4.
https://www.baeldung.com/spring-expression-language#operators
https://docs.spring.io/spring-framework/docs/4.2.x/spring-framework-reference/html/expressions.html
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
