moditect / layrry

A Runner and API for Layered Java Applications
Apache License 2.0
328 stars 33 forks source link

Service binding does not work #227

Closed azhuchkov closed 11 months ago

azhuchkov commented 11 months ago

I'm trying to use layrry to bootstrap several layers with different services inside modules, and it seems that I'm totally unable to make ServiceLoader return something except null. I tried a single layer, several layers - nothing. Is it some platform restriction or framework design decision (I am aware of plugins support)?

P.S. I'm new to Java modules, sorry if I say something that looks stupid.

azhuchkov commented 11 months ago

I think I've found the issue reason: it's necessary to pass a class loader into ServiceLoader.

Something like that: ServiceLoader.load(ServiceApi.class, Main.class.getClassLoader())