public interface Ginjector
Injector
, this type can be used to bootstrap injection. Unlike
Guice, however, this is not a type that you create, but rather a type that you extend. It's
best explained with an example. Consider this Guice code:
// Define and create a Module Module applicationModule = ...; // create an Injector Injector injector = Guice.createInjector(applicationModule); // bootstrap the injection injector.getInstance(Application.class);Here's the equivalent GIN code:
// Define a GinModule (e.g. ApplicationModule) but don't create it.
// create a Ginjector
ApplicationGinjector ginjector = GWT.create(ApplicationGinjector.class);
// bootstrap the injection
RootPanel.get().add(ginjector.getApplication());
(somewhere else...)
// define a Ginjector subtype
@
GinModules(ApplicationModule.class)
public interface ApplicationGinjector extends Ginjector {
Application getApplication();
}
Note that this is not named "G-injector" -- its "GIN-jector."Copyright © 2008–2018. All rights reserved.