The problem I see with this idea (and with the idea to pass LibraryB's
module to LibraryA constrcutor) is that LibraryB may well be required in
more than one libraries! What if LibraryC also needs LIbraryB? LibrayrA and
LibraryC can't both bind its dependencies, right?
I provide an abstract module class in LibraryA that does all the
> bindings for LibraryA and specifies the required bindings as abstract
> methods. LibraryB would then subclass this module and add it to the list
> of moules while creating the injector.
>
> Example:
>
> LibraryAModule extends AbstractModule {
> configure() {
> bind(SomeLibraryAInterface.class).to(SomeLibraryAImpl.class);
> bind(SomeOtherLibraryAInterface.class).to(getSomeOtherClass());
> }
> abstract Class<SomeOtherLibraryAInterface> getSomeOtherClass();
> }
>
> -dirk
>
>
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.