Understanding Spring Core Concepts Before Spring Boot

I used Spring Boot for a while before I actually understood Spring. That was a mistake.... Using Spring Boot without knowing Spring is like using a calculator without knowing math.. 💡That’s why before jumping into Spring Boot, let’s first understand the core concepts of Spring﹗ In the last post, we discussed that Spring is a Dependency Injection framework. But what does that actually mean❓ Let’s break it down 🧐 Let’s understand this with an Example: Suppose we have two classes, i.e., A and B. A depends on B. In core Java, we usually 1️⃣ Create the object of class B. 2️⃣ Manually pass it to class A 3️⃣ Then create the object of A 🤔 So the responsibility of creating and managing objects lies completely on us. But in the Spring world, this is forbidden🚫. Why❓ 👉 As we are having Inversion of Control (IOC) Container. IOC Container is a kind of predefined program, which: 1️⃣ Create an object. 2️⃣ Hold them in memory. 3️⃣ And inject them whenever required. i.e., it is responsible for maintaining the whole object lifecycle. We just need to provide two things to the IOC container for creating the object: 1. beans - pojo classes 2. Configuration file/XML configuration—Here we tell it which beans are dependent upon which. That’s why it’s called Inversion of Control, as the control is inverted from the developer to the framework. In the next post, we’ll see Dependency Injection in action with code. #SpringFramework #Java #SpringCore #IoCContainer #BackendDevelopment #CodingBasics #Episode3 #springboot

  • diagram

To view or add a comment, sign in

Explore content categories