Hi everyone 👋 Continuing the Spring Boot Annotation Series 👇 📌 Spring Boot Annotation Series Part 25 – @ModelAttribute @ModelAttribute is used to bind request data (form data / query params) to a Java object. It is part of the Spring Framework and mainly used in Spring MVC applications. 🔹 Why do we use @ModelAttribute? When we receive multiple values from a request (like form data), instead of handling each parameter separately, we can bind them directly to an object. 👉 Makes code clean and structured. 🔹 Where is it used? Form submissions (HTML forms) Query parameters MVC applications (not mostly REST APIs) 🔹 In Simple Words @ModelAttribute takes request data and converts it into a Java object. 👉 🧠 Quick Understanding Binds request data to object Used in form handling Works with query/form data Not mainly used for JSON #SpringBoot #Java #ModelAttribute #SpringMVC #BackendDevelopment #LearningInPublic
Spring Boot @ModelAttribute Binding Request Data to Java Objects
More Relevant Posts
-
File Uploads and Retrieval in Spring Boot Master file management in modern web applications by exploring File Uploads and Retrieval in Spring Boot. Handling binary data is a core requirement for enterprise systems, and this guide provides a deep dive into building a robust solution using REST controllers and the MultipartFile interface. Following a "core-to-shell" approach, you’ll learn to integrate foundational Java NIO operations with high-level Spring APIs to create a seamless bridge between raw disk storage and your frontend. Discover how to implement secure uploads and efficient file fetching while maintaining a clean, scalable microservices architecture. => Multipart Management: Efficiently process file streams with Spring Boot. => Java NIO Mastery: Use modern I/O for high-performance file handling. => RESTful Fetch: Implement endpoints for secure content retrieval. https://lnkd.in/gyQvP5QA #SpringBoot #spring #springframework #springbootdeveloper #Maven #Java #java #JAVAFullStack #RESTAPI #Microservices #BackendDev #JavaNIO #FileUpload #WebDevelopment #CodingTutorial #codechallenge #programming #CODE #Coding #code #programmingtips
To view or add a comment, sign in
-
🧬 Spring Boot – Understanding @RequestBody Today I learned how Spring Boot handles data coming from the client using @RequestBody. 🧠 Key Concept: 👉 "@RequestBody" is used to receive JSON data from the frontend and convert it into a Java object automatically. 🔁 Flow: Client (JSON) → @RequestBody → Java Object 💡 This makes API development clean and efficient without manual parsing. ✔️ Helps in handling POST & PUT requests ✔️ Automatically maps request data to objects ✔️ Simplifies backend code 📌 Real Use Case: • Creating users • Updating data • Handling form submissions 💻 DSA Practice: • Prime number check • Factorial calculation 🧠 Quick Check: "@RequestBody" is used to receive data from client ✅ ✨ Understanding how data flows from frontend to backend is a key step in mastering REST APIs. #SpringBoot #Java #BackendDevelopment #RESTAPI #WebDevelopment #DSA #LearningInPublic
To view or add a comment, sign in
-
🚀 Day 46: Mastering Data Binding in Spring MVC Continuing my Java Developer journey! Today was all about understanding how data moves from the frontend to my controllers and back. I spent the day diving deep into Spring MVC’s data handling capabilities. Here’s a breakdown of what I covered: @RequestParam vs. @PathVariable: Learned when to use Query Parameters (e.g., ?id=101) versus Path Variables (e.g., /user/101) to capture dynamic data from URLs. Data Binding (1-Way & 2-Way): 1-Way: Passing data from the Controller to the View using the Model object. 2-Way: Using Spring’s form handling to keep the View and the Model in sync, making form submissions seamless. Spring Tag Library: Explored how to use specialized JSP tags to bind form elements directly to Java objects, reducing boilerplate code and improving type safety. Seeing these pieces click together makes building web applications feel much more intuitive. Onward to Day 47! 👨💻 #Java #SpringFramework #SpringMVC #WebDevelopment #Backend #JavaDeveloper #LearningJourney #CodingLife #Telusko Hyder Abbas Naman Pahariya
To view or add a comment, sign in
-
-
#Post4 In the previous post, we understood how request mapping works using @GetMapping and others. Now the next question is 👇 How does Spring Boot handle data sent from the client? That’s where @RequestBody comes in 🔥 When a client sends JSON data → it needs to be converted into a Java object. Example request (JSON): { "name": "User", "age": 25 } Controller: @PostMapping("/user") public User addUser(@RequestBody User user) { return user; } 👉 Spring automatically converts JSON → Java object This is done using a library called Jackson (internally) 💡 Why is this useful? • No manual parsing needed • Clean and readable code Key takeaway: @RequestBody makes it easy to handle request data in APIs 🚀 In the next post, we will understand @PathVariable and @RequestParam 🔥 #Java #SpringBoot #BackendDevelopment #RESTAPI #LearnInPublic
To view or add a comment, sign in
-
🚀 Spring Framework 🌱 How IOC Works Internally — Step by Step Most developers use Spring daily but few understand what happens under the hood. Here's the complete IOC lifecycle 👇 1️⃣ Configuration Loading Spring reads your config — Annotations, XML, or Java Config (@Component, @Bean). 2️⃣ Bean Definition Creation Spring scans classes and creates bean definitions (metadata about objects). 3️⃣ IOC Container Initialization The IOC container (ApplicationContext) starts and prepares to manage beans. 4️⃣ Object Creation (Bean Instantiation) Spring creates objects — you never call new yourself. 5️⃣ Dependency Injection (DI) Spring wires required dependencies automatically (@Autowired, constructor, setter). 6️⃣ Bean Initialization Spring calls init methods after injection is complete (@PostConstruct). 7️⃣ Bean Ready to Use ✅ The object is fully configured and available to the application. 8️⃣ Bean Lifecycle Management Spring manages the entire lifecycle: Creation → Usage → Destruction. 9️⃣ Bean Destruction On shutdown, Spring calls destroy methods (@PreDestroy). ✨ IOC = You focus on business logic. Spring handles object creation & management. #Java #SpringFramework #BackendDevelopment #Coding #InterviewPreparation
To view or add a comment, sign in
-
-
While working on backend systems, I revisited some features from Java 17… and honestly, they make code much cleaner. One feature I find really useful is Records. 👉 Earlier: We used to write a lot of boilerplate just to create a simple data class. Getters Constructors toString(), equals(), hashCode() ✅ With Java 17 — Records: You can define a data class in one line: public record User(String name, int age) {} That’s it. Java automatically provides: ✔️ Constructor ✔️ Getters ✔️ equals() & hashCode() ✔️ toString() 💡 Practical usage: User user = new User("Dipesh", 25); System.out.println(user.name()); // Dipesh System.out.println(user.age()); // 25 🧠 Where this helps: DTOs in APIs Response objects Immutable data models What I like most is how it reduces boilerplate and keeps the code focused. Would love to know — are you using records in your projects? #Java #Java17 #Backend #SoftwareEngineering #Programming #Microservices #LearningInPublic
To view or add a comment, sign in
-
Built an HTTP server from scratch in Java. No frameworks. No Netty. No Spring Boot. Just raw sockets, manual byte parsing, and a thread pool wired from the ground up. The goal was never to reinvent the wheel. It was to understand what the wheel is actually made of. What was built: → TCP socket listener handing connections to a fixed thread pool of 500 workers → HTTP/1.1 parser written byte-by-byte - request line, headers, body (JSON + form-urlencoded) → Router handling HEAD, GET and POST with static file serving and query param injection → Structured error responses for 400, 404, 500, 501, and 505 → WebRootHandler with path traversal protection → Full JUnit test suite, Maven build, SLF4J logging, and a Dockerized deployment What it reinforced: Networking - HTTP is just bytes on a wire. The kernel speaks TCP, not HTTP. The parser is what gives those bytes meaning. Operating systems - the boundary between user space and kernel space stopped being abstract. accept(), read(), write() are syscalls. Everything else lives in the JVM. Concurrency - 500 threads sharing a single handler. Statelessness stops being a design preference and becomes a correctness requirement. Docker - the container wraps the JVM, not the kernel. Syscalls go to the host kernel. There is no container kernel. Building something from scratch is one of the most honest ways to learn. Every assumption gets tested, every abstraction gets earned. A recommendation from Kashif Sohail turned into weeks of going deep on networking, OS internals, and concurrency. Grateful for that push. GitHub repo :https://lnkd.in/dxxjXxpt #Java #Networking #OperatingSystems #Backend #SystemsEngineering #Docker #OpenSource
To view or add a comment, sign in
-
-
🚀 Spring Framework 🌱 | Day 5 How IOC Works Internally (Step by Step) 1️⃣ Configuration Loading Spring reads configuration (Annotations / XML / Java Config like @Component, @Bean). 2️⃣ Bean Definition Creation Spring identifies classes and creates bean definitions (metadata about objects). 3️⃣ IOC Container Initialization IOC container (like ApplicationContext) starts and prepares to manage beans. 4️⃣ Object Creation (Bean Instantiation) Spring creates objects (beans) instead of you using new. 5️⃣ Dependency Injection (DI) Spring injects required dependencies (@Autowired, constructor, setter). 6️⃣ Bean Initialization Spring calls init methods (@PostConstruct or custom init). 7️⃣ Bean Ready to Use Now the object is fully ready and managed by Spring. 8️⃣ Bean Lifecycle Management Spring manages the entire lifecycle (creation → usage → destruction). 9️⃣ Bean Destruction When the application stops, Spring calls destroy methods (@PreDestroy). ✨ IOC = Less effort, more control by Spring! #Java #SpringFramework #BackendDevelopment #Coding #InterviewPreparation
To view or add a comment, sign in
-
-
Upgrading to Spring Boot 3 isn’t just about bumping a version number. It is an excuse to finally use modern Java. If you are still writing enterprise backend code the exact same way you did in Java 8, you are leaving massive performance and readability gains on the table. Here are the 4 modern features that completely change how I write Spring Boot applications today: 1. Java Records (The Lombok Killer) Stop writing endless boilerplate or relying on @Data for your DTOs. Records give you immutable data carriers out of the box. They are perfect for API request/response payloads and make your data layer infinitely cleaner. 2. Pattern Matching If your service layer is filled with nested if-else blocks and explicit (User) obj casting, Pattern Matching for instanceof and switch expressions will cut your code size in half. It turns messy conditional logic into clean, readable routing. 3. String Templates Say goodbye to ugly string concatenation (+) or clunky String.format() calls. Building dynamic SQL queries, JSON payloads, or error messages is finally as clean as it is in Python or JavaScript. 4. Virtual Threads (The Game Changer) Remember all those headaches with @Async thread pool limits and context drops? Virtual Threads (Project Loom) change the entire concurrency model. You can now spin up millions of lightweight threads without crashing your server's memory. Blocking I/O operations (like database calls or external API requests) are virtually free now. Java isn't the slow, verbose language it used to be. It has quietly become incredibly modern. Which of these 4 features has made the biggest impact on your daily coding? Let's discuss below. 👇 #Java #SpringBoot #SoftwareEngineering #BackendDevelopment #Microservices #VirtualThreads #CleanCode
To view or add a comment, sign in
-
JVM Architecture - what actually runs your Java code ⚙️ While working with Java and Spring Boot, I realized something: We spend a lot of time writing code, but not enough time understanding what executes it. That’s where the JVM (Java Virtual Machine) comes in. A simple breakdown: • Class Loader Loads compiled `.class` files into memory. • Runtime Data Areas * Heap → stores objects (shared across threads) 🧠 * Stack → stores method calls and local variables (per thread) * Method Area → stores class metadata and constants * PC Register → tracks current instruction * Native Method Stack → handles native calls • Execution Engine * Interpreter - runs bytecode line by line * JIT Compiler - optimizes frequently used code into native machine code ⚡ • Garbage Collector Automatically removes unused objects from memory --- Why this matters: Understanding JVM helps in: * Debugging memory issues (like OutOfMemoryError) * Improving performance * Writing more efficient backend systems --- The more I learn, the more I see this pattern: Good developers write code. Better developers understand how it runs. #Java #JVM #BackendDevelopment #SpringBoot #SystemDesign
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development