Services and Bindings - expected usage scenarios

Jochen Theodorou blackdrag at gmx.org
Wed Nov 30 17:00:01 UTC 2016



On 30.11.2016 17:31, mark.reinhold at oracle.com wrote:
[...]
> The SE Platform has ServiceLoader rather than a built-in DI mechanism
> because the former is more primitive and imposes less overhead, while
> the latter can be built on top of the former.  (I don't really know,
> nor care, whether java.util.ServiceLoader is officially an instance
> of the Service Locator pattern.)

while some form of DI can be built on top of ServiceLoader, it usually 
is not. And that is because it is really annoying to do so. Imagine for 
example in Spring what you have to do to get DI configured only in Java 
running on top of the ServiceLoader architecture. Just imagine how many 
additional ClassLoaders you will need and now also Layers. And then 
imagine how you are going to test all this... And you really, really 
cannot expect that this all will be done without the user noticing 
additional quirks.

I see not a single thing being better for DI with non-static descriptors 
in jigsaw. Only many more complications

bye Jochen


More information about the jigsaw-dev mailing list