Hi,
I have some questions regarding ClientBundle and GIN.
Suppose the following blank bundle:
public interface MyClientBundle extends ClientBundle {
}
I want GIN to create the instance(es) of the MyClientBundle for me. The GIN-docs say (
http://code.google.com/p/google-gin/wiki/GinTutorial#Deferred_Binding):
Note: Gin will not bind the instances created through GWT.create
in singleton scope. That should not cause unnecessary overhead though,
since deferred binding generators usually implement singleton patterns
in their generated code. Usage 1) Don't specify MyClientBundle class in GinModule - this means that there is no bind(MyClientBundle.class) somewhere.
When injecting MyClientBundle into some beans, I see that there is always a new (not-singleton) instance of MyClientBundle -> as the gin-docs say
Usage 2)Specify MyClientBundle class in GinModule as follows:
bind(MyClientBundle.class).in(Singleton.class);When injecting MyClientBundle into some beans, I see that there is always the same (singleton) instance of MyClientBundle -> are the docs incorrect? or to i miss something here?
Usage 3)Specifiy MyClientBundle class in a Gin Module as follows:
bind(MyClientBundle.class);
This leads to the following error:
com.google.inject.CreationException: Guice creation errors:
1) No implementation for gwtapp.client.navigation.MyClientBundle was bound.
at gwtapp.client.navigation.NavigationModule.configure(NavigationModule.java:19)
1 error
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:416)
- imo the gin-docs are not correct here, because it is possible to create a ClientBundle with singleton-scope right? or do i miss something?
- what approach (usage1 vs usage2) would you recommend
- why does usage3 lead to an exception?
i use gin1.5
thank you,
daniel