What is a service provider?
Sorry if this is a silly question but I am a C developer who just happen to be in a meeting with a bunch of .NET guys and over heard their convers开发者_JAVA百科ation.
They were sketching out a design and constantly talk of service provider, services and spring. Instead of looking silly by asking them, I just decided to post here.
BTW, I am doing device driver development (have been for more than 10 years using C) and NEVER heard of service provider.
If it was mentioned in the context of Spring, then most likely they were talking about the Service Locator Pattern.
The Service Locator is a concept in Dependency Injection frameworks; it's the "kernel" you can use to obtain abstract services of an arbitrary type. Usually with some code like this:
IMyService myService = locator.GetService<IMyService>();
In other words, it provides a special interface for components to gain access to an abstract service - usually an interface type - without knowing anything about the concrete type or how it's instantiated.
精彩评论