Category: java
spel supports literals
Published on 30 Sep 2026
Explanation
Supports literals such as strings, numbers, booleans, and null values.
Code:
#{100}
#{3.14}
#{true}
#{'Spring Boot'}
#{null}
Explanation
SpEL supports arithmetic operators for calculations.
Code:
#{10 + 5}
#{10 - 5}
#{10 * 5}
#{10 / 5}
#{10 % 3}
Explanation
Comparison operators can be used to compare values in SpEL expressions.
Code:
#{10 > 5}
#{10 < 20}
#{10 == 10}
#{10 != 5}
Explanation
Logical operators allow multiple conditions to be combined.
Code:
#{10 > 5 and 20 > 10}
#{10 > 100 or 20 > 10}
#{not false}
Explanation
SpEL supports variables using the # symbol when variables are provided through the evaluation context.
Code:
#name #age #price * #quantity // Example result: #price = 100 #quantity = 3 // 300