You can also use com.gogle.inject.util.Modules.override(Module... modules)
to override bindings as suggested by @albertb at
http://stackoverflow.com/questions/483087/overriding-binding-in-guice
On Saturday, March 17, 2007 5:45:24 AM UTC+2, ajoo@gmail.com wrote:
Hi there.
We have a parent project and a child project. The child project is a
customization of the parent project, where some of the interfaces in
parent project will have different implementation classes.
What I was thinking that we could do was to subclassing a Module as:
parent project:
class MyModule extends AbstractModule {
protected void configure() {
bind(Interface1.class).to(Class1.class);
bind(Interface2.class).to(Class2.class);
...
}
}
child project:
class SubModule extends MyModule {
protected void configure() {
super.configure();
bind(Interface2.class).to(Subclass2.class);
}
}
This way I'm hoping that sub module will use almost every setting in
parent project with the implementation class of Interface2 changed to
Subclass2.
But if I'm not mistaken, Guice isn't happy about this. An interface
can only have one bindings.
I'm trying to think of a workaround or a better solution. At the same
time, hope some of you guys may shed some light for me.
Ben.
--
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 google-guice+unsubscr...@googlegroups.com.
To post to this group, send email to google-guice@googlegroups.com.
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.