Modular services with OpenJDK Jigsaw and Guice

Paul Sandoz paul.sandoz at oracle.com
Tue Jul 10 01:38:27 PDT 2012


On Jul 9, 2012, at 1:49 PM, Jaroslav Tulach wrote:

> Dne Pá 6. července 2012 18:43:08, Paul Sandoz napsal(a):
>> Something for the weekend:
>> 
>> http://earthly-powers.blogspot.fr/2012/07/modular-services-with-openjdk-jigs
>> aw.html
> 
> Interesting. I was playing with something similar, but with Spring:
> http://wiki.apidesign.org/wiki/LookupAndSpring
> Translation notes:
> - Lookup.getDefault() means something like ServiceLoader.load(all_types)
> - @ServiceProvider is "provides service"
> 
> I was trying to do this with Guice as well, but it does not work well. Guice 
> would like to know all registered services before its "module" is constructed 
> and we were seeking for a lazy binding. However we have not managed to 
> convince Guice to call us back, when a particular type is needed. We gave up.
> 

Sisu provides extensions to Guice to avoid the need to explicitly bind:

  http://www.eclipse.org/sisu/

but i dunno if that can do what you want.

FWIW i have a preference for explicit bindings, it seems to fit well with the idea of a module declaration expressing it's interface to consumers.

Paul.


More information about the jigsaw-dev mailing list