Skip to main content


Showing posts with the label Service Locator

Dependency Injection and Service Locator

Dependency injection is a interface programing technique which is based on altering class behavior without the changing the class internals. That's been done by coding against interface inside of the class and exposing interface definition to code external to the component. There are three types (different techniques) of making dependency injection: constructor DI, setter DI and interface DI.

Service locator is a design pattern similar to dependency injection in a meaning that allows altering the class behavior without altering the class code by coding against the interface inside of the class. The difference is that there's no direct exposure of interface to code outside of the class. Instead class is using "well known object" inside, to get from it desired interface implementation.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop …