mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-09-08 20:20:09 +00:00
docs: service locator and service stub diagrams
This commit is contained in:
@@ -33,6 +33,10 @@ Wikipedia says
|
||||
|
||||
> The service locator pattern is a design pattern used in software development to encapsulate the processes involved in obtaining a service with a strong abstraction layer. This pattern uses a central registry known as the "service locator", which on request returns the information necessary to perform a certain task. Proponents of the pattern say the approach simplifies component-based applications where all dependencies are cleanly listed at the beginning of the whole application design, consequently making traditional dependency injection a more complex way of connecting objects. Critics of the pattern argue that it is an antipattern which obscures dependencies and makes software harder to test.
|
||||
|
||||
Sequence diagram
|
||||
|
||||

|
||||
|
||||
## Programmatic Example of Service Locator Pattern in Java
|
||||
|
||||
The Service Locator design pattern is used to abstract the processes involved in obtaining a service. It uses a central registry, the "service locator", which returns the necessary information to perform a task upon request. This Java design pattern is particularly useful in enterprise Java applications where services need centralized management.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 95 KiB |
Reference in New Issue
Block a user