before we talk about IOC (Inversion of control) and DI (dependency injection) i will firstly explain why it is used.

so basically when we create different classes in a spring boot application excluding the main class, to call them in the main class we have to create an object. this works if you work in a small project.

but if you are working in big organizations you have to manage tons of classes. and manually creating an object of each particular class makes it messy. so here is where IOC and DI work to solve this problem.

Ioc :- ioc is a design principle where a framework or container takes over program flow of dependency management.

in simple words as i mentioned above, if we create tons of classes it gets messy. so Ioc is a principle where we handover object creation to the container. and ioc takes a separate space in heap memory to manage all of object creation and it wont affect the program.