Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to override binding in GIN

Tags:

gwt

guice

gwt-gin

I find the answer for Guice Overriding Binding in Guice but don't know how to do the same for GIN in GWT.

Thanks in advance!

like image 819
Rick Li Avatar asked Sep 06 '11 02:09

Rick Li


1 Answers

As far as I know, it's not supported.

To answer your comment:

If you're running "pure" JUnit tests (not GWTTestcases) you don't use GIN, you use Guice, and in Guice you can override modules. If you want to reuse GIN modules, then wrap them using GinModuleAdapter. So you can do something like this:

static class MyGinModule extends GinModule {
  ...
}
static class MyGuiceModule extends AbstractModule {
  ...
}

// And somewhere in your code, here's how you could create the Injector
Module myWrappedGinModule = new GinModuleAdapter(new MyGinModule());
Module myModule = Modules.override(myWrappedGinModule).with(new MyGuiceModule());
Injector injector = Guice.createInjector(myModule);
like image 148
Luismahou Avatar answered Oct 15 '22 18:10

Luismahou