Dependency injection

Dependency injection is a design pattern that handles dependencies and resolves them. An instance of the dependencies will be passed to the dependent in order to use it. If a client module or class is dependent on a service, it needs to create an instance of the service before using it. We can inject or pass the instance of the service to the client using a dependency injection pattern, rather than a client module building the service.

Applying dependency injection enables us to create a client that does not have any knowledge of the service to be built and of the actual service it is consuming. The client will only have knowledge about the interface of the service as it needs to know how to use the service.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset