Wednesday, May 23, 2018

dependency injection (DI) vs inversion of control (IoC) ?

Problem statement: what do you mean by dependency injection (DI) and inversion of control (IoC)?
  • IoC (Inversion of Control): giving control to the container to get instance of an object is called inversion of control, meaning instead i'm creating the object using new operator, let container do that for me.
  • DI (Dependency Injection): way of injecting (providing) properties to an object is called DI.
  • Types of Dependency Injection
  1. Constructor Injection
  2. Setter/Getter Injection - property in xml
  3. Interface Injection (spring does not support)

No comments:

Post a Comment

Blueprint for self-improvement

To learn faster: Make the process fun To understand yourself : Write To understand the world better : Read To build deeper connection : Lis...