I am trying to override the binding in a child injector that has already been configured in the base injector.
like this:
public class PersistenceModule extends Abstract{ @Override protected void configure() { bind(IProductPersistenceHelper.class).to(ProductPersistenceHelper.class); } }
then:
Injector injector = Guice.createInjector(new PersistenceModule()); injector.createChildInjector(new AbstractModule(){ @Override protected void configure() { bind(IProductPersistenceHelper.class).to(MockProductPersistenceHelper.class); } })
Guice complains that he is already attached to this. Are there any patterns or recommendations on this issue?
java guice
Roman
source share