I have a question about using Gin to inject GWT Async RPC service.
I have two classes both using the same Async service:
class TheViewA {
@Inject
public TheViewA(MyServiceAsync myServiceASync) {
....
}
}
class TheViewB {
@Inject
public TheViewB(MyServiceASync myServiceASync) {
....
}
}
This works fine. However, I found out this will cause GWT internally call:
GWT.create(MyServiceASync.class)
twice for each injection. I don't know what is the disadvantage of this, but I am thinking they can both share a single MyServiceAsync instance.
Can someone tell me how to configure Gin (Guice) so that only one instance of MyServiceAsync is created for both injection?
Or Is it OK to create separate instances for both injection and why?
Many thanks.