1·Another way is for each component type to use its own instance of service locator, not a singleton.
另外一个方法是每个组件类型使用它自身的服务定位器实例,而不是集合。
2·This is because the service locator will cache the resource for whichever component USES the overloaded name first.
这是因为服务定位器将缓存不论哪个组件首次使用时所重载的名称的资源。
3·The client passes in a unique identifier — a resource name — for the resource; the service locator finds the resource and returns it to the client.
客户端为资源传递一个唯一的标识符(资源名),服务定位器找到这个资源并把它返回给客户端。
4·The most methodical way of doing this is to find one of the service locator lookups in a constructor and push it to the class instantiating it.
做这件事情最有条理的方法是在组件的构造函数中找到执行服务定位器查找的语句,把该语句移到实例化该组件的类中。
5·When two components use a resource name that is overloaded — that is, a name that is bound to two different resources — a caching service locator returns the same resource to both components.
当两个组件使用一个重载的资源名,也就是说,一个名称绑定到两个不同的资源,缓存服务定位器为两个组件返回相同的资源。