On 19/12/2024 20:54, David Lloyd wrote:
I wonder: would this also allow services to be found across the layer boundaries? For example, an API from a layer that the application can see uses a service provided by an implementation in a layer that the application cannot see?

Service loading is specified to work across module layers. Code in a child layer might invoke ServiceLodaer to locate providers in its own and parent layer, assuming the service is in the parent layer. Code in the parent layer might invoke ServiceLoader to locate providers in the child layer. If everyone were in the same room in front of a white board then this would be easy to draw.

An important point about service providers is that they be fully encapsulated. So while many modules can "see" the service provider module, where "see" means visibility, then nobody can access.

-Alan

Reply via email to