Problem getResourceAsStream for classes from parent layer
Alan Bateman
Alan.Bateman at oracle.com
Mon Nov 27 18:22:17 UTC 2023
On 27/11/2023 17:18, Alex Orlov wrote:
> Hello all,
>
> I have a JPMS application with layer tree. In Module X on|Layer C|I
> need to create Spring context while Spring framework is located
> on|Layer B|:
>
> |boot layer |- Layer B with Spring framework. |- Layer C with Module X
> and Module Y|
> All child created this way:
> parentClassLoader = ClassLoader.getSystemClassLoader();
> ModuleLayer.Controller controller =
> ModuleLayer.defineModulesWithOneLoader(cf, parentLayers,
> parentClassLoader);
>
Here's what we have in the ModuleLayer.defineModulesWithOnLoader method
description:
"The class loader created by this method locates resources (getResource,
getResources, and other resource methods) in all modules in the layer
before searching the parent class loader."
When creating layer C, can you specify the parentLoader to be the loader
for any module in layer B? I think that should work for this setup.
-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jigsaw-dev/attachments/20231127/207dc334/attachment-0001.htm>
More information about the jigsaw-dev
mailing list