<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Fri, Dec 20, 2024 at 7:52 AM Alan Bateman <<a href="mailto:alan.bateman@oracle.com">alan.bateman@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div>
On 19/12/2024 20:54, David Lloyd wrote:<br>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">
<div style="font-family:arial,helvetica,sans-serif">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?</div>
</div>
</div>
</blockquote>
<br>
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.<br>
<br>
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. <br>
<br>
-Alan<br>
</div>
</blockquote></div><div><br clear="all"></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I see, so it seems that there still would have to be a parent-child relationship (possibly transitive) between the layer containing the service consumer and the layer containing the service provider, correct? And the provider must be in a parent layer. I.e. using `jlink` doesn't magically make this constraint disappear, which is what I thought was being implied.</div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Thanks.</div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">- DML • he/him<br></div></div></div>