Monday, November 1, 2010

Injecting EventBus with GIN

Hi all

Trying to inject the eventbus into a component but I'm getting the
"has no default (zero args) constructor." error. Any clues what I'm
doing wrong? Very new to GIN, so it might be trivial..

Here is my code:

module:
public class MyWidgetClientModule extends AbstractGinModule {
protected void configure() {
bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);

}
}

injector:
@GinModules(MyWidgetClientModule.class)
public interface MyWidgetGinjector extends Ginjector {

}

and the component I trying to inject:
public class I18NLabel extends Label implements
ChangeLanguageEventHandler{


private final SimpleEventBus eventBus;
private String key;

@Inject
public I18NLabel(SimpleEventBus eventBus) {
this.eventBus = eventBus;
}
...
...

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment