Hackforge Academy

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

πŸš€ Learn Spring Boot with real-world projects

πŸ’‘ Build REST APIs step by step

🧠 Improve backend development skills

🎯 Get career-ready practical training

Join Our Free WhatsApp Community

Direct access to niche-specific mentors and peers on WhatsApp.

🐍

Python Community

Discuss Django, FastAPI, AI integration, and automation scripts with 15k+ developers.

Join Python Community
βš›οΈ

React Community

Master Next.js, Framer Motion, and State Management. Share your latest UI components.

Join React Community
β˜•

Java Community

Deep dives into Spring Boot, Microservices architecture, and high-performance backend ops.

Join Java Community