title: How does ServiceLoader.load work with class loaders in JPMS?
body: <p>I have two JPMS layers:</p>
  
  <ol>
  <li>Boot layer with <code>module A</code> loaded by <code>ClassLoaders$AppClassLoader@4fca772d</code></li>
  <li>Child layer with <code>module B</code> that provides cervices and loaded by <code>Loader@6b58b9e9</code></li>
  </ol>
  
  <p>The parent classloader of <code>Loader@6b58b9e9</code> is <code>ClassLoaders$AppClassLoader@4fca772d</code>.</p>
  
  <p>In <code>module A</code> I have the following code:</p>
  
  <pre><code>ServiceLoader&lt;ModuleAInterface&gt; sl = ServiceLoader.load(ModuleAInterface.class);
  </code></pre>
  
  <p>However, the services of <code>Module B</code> are found only when context class loader is <code>Loader@6b58b9e9</code> and not found when context class loader is <code>ClassLoaders$AppClassLoader@4fca772d</code>.</p>
  
  <p>The question - is it possible to get services of <code>module B</code> in <code>module A</code> without knowing class loader of <code>module B</code> in such configuration.</p>