tl;dr Patterns, 20 Years Later: A Service Locator is used to encapsulate the process(es) involved in obtaining a service via a strong abstraction layer. This pattern uses a central registry, which on request returns the information necessary to perform a certain task.

Problem

Context

Solution

Some questions arise out of this:

Implementations

Consequences

A Service Locator tends to lead to several consequences:

Variations

A couple of different takes on the Service Locator include:

Last updated: 10 August 2024

Tags: pattern   behavioral