<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">As specified in <a href="https://help.intrexx.com/apidocs/jdk17/api/java.base/java/lang/module/Configuration.html#resolveAndBind(java.lang.module.ModuleFinder,java.util.List,java.lang.module.ModuleFinder,java.util.Collection)">https://help.intrexx.com/apidocs/jdk17/api/java.base/java/lang/module/Configuration.html#resolveAndBind(java.lang.module.ModuleFinder,java.util.List,java.lang.module.ModuleFinder,java.util.Collection)</a><div><br></div><div>all modules reachable by a ModuleFinder are examined for uses-provides relationship and added to the set of resolved modules.</div><div><br></div><div>It gives you the optionality: just add/remove artefacts to/from the module path to add/remove service providers.</div><div><div><br><blockquote type="cite"><div>On 25 Apr 2023, at 03:39, Rob Bygrave <robin.bygrave@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div><div dir="ltr"><i>> only y and y.inject must be in two separate JARs.</i><div><br></div><div>Does this work without <i>any</i> module having a `requires y.inject`? If so, how is the y.inject module get included without a<span class="gmail-Apple-converted-space"> </span>`requires y.inject` being specified? (There is an obvious follow up question if that is the case as it likely breaks the case where only y module is used).</div><div><br></div><div><br></div><div>Cheers, Rob.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 25 Apr 2023 at 01:32, Ron Pressler <<a href="mailto:ron.pressler@oracle.com">ron.pressler@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div style="line-break:after-white-space">
<br>
<div><br>
<blockquote type="cite">
<div>On 24 Apr 2023, at 14:23, Josiah Noel <<a href="mailto:josiahnoel@gmail.com" target="_blank">josiahnoel@gmail.com</a>> wrote:</div>
<br>
<div>
<div dir="ltr">
<div dir="ltr">
<div class="gmail_quote">
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
I’m confused. To use the implementation of the `x.Plugin` service (defined in X) that you want Y to `provides` an implementation of, some module *must* have a `uses x.Plugin`. The runtime has to know that that service is needed by the program. Maybe the application
`uses` it, but X itself could also declare that it `uses` an implementation of a service interface that it, itself, declares. So perhaps it is X that `uses X.plugin`, but someone has to actually say they want to use the service.<br>
</blockquote>
<div> </div>
<div>I believe I'm picking up what you're putting down, but let's review it again to be sure.</div>
<div><br>
</div>
<div> </div>
<div>In artifact X we have:</div>
<div><br>
</div>
<div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
<div> exports x.spi;</div>
<div> uses x.spi.Plugin;</div>
</blockquote>
<div><br>
</div>
</div>
<div>in artifact Y we have two modules: y and y.inject.</div>
<div><br>
</div>
<div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
exports y.stuff;<br>
</blockquote>
</div>
<div><br>
</div>
<div>And </div>
<div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div> requires x;</div>
<div> provides x.spi.Plugin with y.inject.PluginImpl;</div>
</blockquote>
<div><br>
</div>
</div>
<div>With this in mind, we have two situations we want to support. we have an application Z that wants to use the Y artifact alone and a case where Z wants to use X and Y.</div>
<div><br>
</div>
<div>With Y alone, the z module should look like this correct?</div>
<div><br>
</div>
</div>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div> requires y;</div>
</blockquote>
<div><br>
</div>
<div> And in the case where Z wants both X and Y (with X doing the service-loading), we do:</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
requires x;<br>
requires y;<br>
</blockquote>
<div><br>
</div>
<div>Am I right to understand that X will service load the y.inject plugin correctly? </div>
</div>
<input name="virtru-metadata" type="hidden" value="{"email-policy":{"disableCopyPaste":false,"disablePrint":false,"disableForwarding":false,"enableNoauth":false,"expandedWatermarking":false,"expires":false,"sms":false,"expirationNum":1,"expirationUnit":"days","isManaged":false,"persistentProtection":false},"attachments":{},"compose-id":"9","compose-window":{"secure":false}}"></div>
</div>
</blockquote>
</div>
<br>
<div>Yes.</div>
<div>This is also how it works today, only y and y.inject must be in two separate JARs.</div>
<div><br>
</div>
<div>— Ron</div>
</div>
</blockquote></div>
</div></blockquote></div><br></div></body></html>