[google-gin] Re: Comment on GinTutorial in google-gin

145 views
Skip to first unread message

googl...@googlecode.com

unread,
Apr 30, 2010, 5:16:29 AM4/30/10
to googl...@googlegroups.com
Comment by gustav.trede:

what about custom RPC ?
GWT-RPC is badly designed and implemented server side: Lack of scalability
(synchronized and static synchronized used everywhere due to incompetence).
With custom rpms there is no real need to use any on demand serializations.
You can just send your pojos as byte[] that you can keep stored in pre
serialized state serverside.


For more information:
http://code.google.com/p/google-gin/wiki/GinTutorial

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

googl...@googlecode.com

unread,
Oct 31, 2010, 12:35:37 PM10/31/10
to googl...@googlegroups.com
Comment by goudreau...@gmail.com:

Does it works with UiBinder?

googl...@googlecode.com

unread,
Nov 12, 2010, 10:45:59 AM11/12/10
to googl...@googlegroups.com
Comment by kristian.jones.uk:

Hi, I'm new to GIN but have a few questions
1. For the Remote Services example do you still need to define this in a
module somewhere or is the point that you can just annotate with @Inject
and it will work.
2. When using MVP, where is the best place to use dependency injection.
Should I use it to create my presenters, so I can do
injector.getPresenter();
3. Is it possible to inject simple objects such as strings.

googl...@googlecode.com

unread,
Nov 13, 2010, 2:38:15 PM11/13/10
to googl...@googlegroups.com
Comment by boppenh...@google.com:

1. Nope, nothing to do, just put your remote service as a parameter on an
@Inject constructor.
2. I've seen lots of debate on this issue.
3. Yes, use binding annotations.
(http://code.google.com/p/google-gin/source/browse/trunk/samples/HigherLower/src/com/google/gwt/gin/higherlower/client/gin/HigherOrLowerModule.java)

googl...@googlecode.com

unread,
Apr 21, 2011, 11:49:34 AM4/21/11
to googl...@googlegroups.com
Comment by SVR...@gmail.com:

I am new to Gin and using GWT 2.2, I added all the dependencies including
guice-assistedinject-snapshot.jar, but I get this error on compile:

Generator 'com.google.gwt.inject.rebind.GinjectorGenerator' threw an
exception while
rebinding 'com.omnex.dashboard.prototype.gwt.widget.TxnTopLevelWidget.OnePageWidgetGinjector'
[java] com.google.inject.internal.ComputationException:
com.google.inject.internal.ComputationException:
com.google.inject.internal.ComputationException:
java.lang.NoClassDefFoundError: com.google.inject.assistedinject.Assisted
[java] at
com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:553)
[java] at
com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:419)
[java] at
com.google.inject.internal.CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
[java] at
com.google.inject.internal.FailableCache.get(FailableCache.java:46)
[java] at
com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:48)
[java] at
com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:121)
[java] at
com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:443)
[java] at
com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:698)
[java] at
com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:630)
[java] at
com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:223)
[java] at
com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:174)
[java] at
com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:704)
[java] at
com.google.inject.internal.FactoryProxy.notify(FactoryProxy.java:45)
[java] at
com.google.inject.internal.BindingProcessor.runCreationListeners(BindingProcessor.java:238)
[java] at
com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:143)
[java] at
com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:116)
[java] at
com.google.inject.InjectorBuilder.build(InjectorBuilder.java:101)
[java] at com.google.inject.Guice.createInjector(Guice.java:105)
[java] at com.google.inject.Guice.createInjector(Guice.java:90)
[java] at
com.google.gwt.inject.rebind.GinjectorGenerator.generate(GinjectorGenerator.java:47)
[java] at
com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48)
[java] at
com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)
[java] at
com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:662)
[java] at
com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
[java] at
com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:74)
[java] at
com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:259)
[java] at
com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:248)
[java] at
com.google.gwt.dev.DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(DistillerRebindPermutationOracle.java:91)
[java] at
com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.doFindAdditionalTypesUsingRebinds(WebModeCompilerFrontEnd.java:106)
[java] at
com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.process(AbstractCompiler.java:254)
[java] at
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:444)
[java] at
com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.compile(AbstractCompiler.java:175)
[java] at
com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.compile(AbstractCompiler.java:288)
[java] at
com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.access$400(AbstractCompiler.java:145)
[java] at
com.google.gwt.dev.jdt.AbstractCompiler.compile(AbstractCompiler.java:632)
[java] at
com.google.gwt.dev.jdt.BasicWebModeCompiler.getCompilationUnitDeclarations(BasicWebModeCompiler.java:124)
[java] at
com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.getCompilationUnitDeclarations(WebModeCompilerFrontEnd.java:54)
[java] at
com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:517)
[java] at
com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:35)
[java] at
com.google.gwt.dev.Precompile.precompile(Precompile.java:541)
[java] at
com.google.gwt.dev.Precompile.precompile(Precompile.java:495)
[java] at
com.google.gwt.dev.Precompile.precompile(Precompile.java:407)
[java] at com.google.gwt.dev.Compiler.run(Compiler.java:215)
[java] at com.google.gwt.dev.Compiler.run(Compiler.java:187)
[java] at com.google.gwt.dev.Compiler$1.run(Compiler.java:159)
[java] at
com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:87)
[java] at
com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:81)
[java] at com.google.gwt.dev.Compiler.main(Compiler.java:166)
[java] Caused by: com.google.inject.internal.ComputationException:
com.google.inject.internal.ComputationException:
java.lang.NoClassDefFoundError: com.google.inject.assistedinject.Assisted
[java] at
com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:553)
[java] at
com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:419)
[java] at
com.google.inject.internal.CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
[java] at
com.google.inject.internal.FailableCache.get(FailableCache.java:46)
[java] at
com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:48)
[java] at
com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:121)
[java] at
com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:443)
[java] at
com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:698)
[java] at
com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:630)
[java] at
com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:223)
[java] at
com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:174)
[java] at
com.google.inject.internal.InjectorImpl.createProviderBinding(InjectorImpl.java:281)
[java] at
com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:662)
[java] at
com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:630)
[java] at
com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:223)
[java] at
com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:174)
[java] at
com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:704)
[java] at
com.google.inject.internal.InjectorImpl.createParameterInjector(InjectorImpl.java:772)
[java] at
com.google.inject.internal.InjectorImpl.getParametersInjectors(InjectorImpl.java:760)
[java] at
com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:55)
[java] at
com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:27)
[java] at
com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:35)
[java] at
com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:33)
[java] at
com.google.inject.internal.FailableCache$1.apply(FailableCache.java:35)
[java] at
com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:549)
[java] ... 47 more
[java] Caused by: com.google.inject.internal.ComputationException:
java.lang.NoClassDefFoundError: com.google.inject.assistedinject.Assisted
[java] at
com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:553)
[java] at
com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:419)
[java] at
com.google.inject.internal.CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
[java] at
com.google.inject.internal.FailableCache.get(FailableCache.java:46)
[java] at
com.google.inject.internal.MembersInjectorStore.get(MembersInjectorStore.java:63)
[java] at
com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:59)
[java] at
com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:27)
[java] at
com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:35)
[java] at
com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:33)
[java] at
com.google.inject.internal.FailableCache$1.apply(FailableCache.java:35)
[java] at
com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:549)
[java] ... 71 more
[java] Caused by: java.lang.NoClassDefFoundError:
com.google.inject.assistedinject.Assisted
[java] at java.lang.Class.getDeclaredFieldsImpl(Native Method)
[java] at java.lang.Class.getDeclaredFields(Class.java:534)
[java] at
com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:605)
[java] at
com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:345)
[java] at
com.google.inject.internal.MembersInjectorStore.createWithListeners(MembersInjectorStore.java:75)
[java] at
com.google.inject.internal.MembersInjectorStore.access$000(MembersInjectorStore.java:32)
[java] at
com.google.inject.internal.MembersInjectorStore$1.create(MembersInjectorStore.java:40)
[java] at
com.google.inject.internal.MembersInjectorStore$1.create(MembersInjectorStore.java:38)
[java] at
com.google.inject.internal.FailableCache$1.apply(FailableCache.java:35)
[java] at
com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:549)
[java] ... 81 more
[java] Caused by: java.lang.ClassNotFoundException:
com.google.inject.assistedinject.Assisted
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:496)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:631)
[java] at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:597)

googl...@googlecode.com

unread,
Sep 21, 2011, 7:25:23 PM9/21/11
to googl...@googlegroups.com
Comment by siyabong...@gmail.com:

Just make sure you do not bind any type called "Cache". You will
errors/exceptions, but it will just not work... silently!!

googl...@googlecode.com

unread,
Oct 21, 2011, 6:13:32 AM10/21/11
to googl...@googlegroups.com
Comment by moho...@web.de:

Hi, I'm new to GIN, just trying to integrate GIN into an existing maven
project. My problem ist that I get a ClassCastException when trying to
create my injector in my EntryPoint:
private final PooledGinjector _injector =
GWT.create(PooledGinjector.class);
although it looks to me that the injector is of the required type:
@GinModules(PooledGinModule.class)
public interface PooledGinjector extends Ginjector {

// SimplePanel getMainPanel();
}
The exception looks like this:
ERROR: Deferred binding failed
for 'net.mbc.contentpool.gwt.client.PooledGinjector'; expect subsequent
failures.
ERROR: Failed to create an instance
of 'net.mbc.contentpool.gwt.client.ContentPoolEntryPoint' via deferred
binding . java.lang.RuntimeException: Deferred binding failed
for 'net.mbc.contentpool.gwt.client.PooledGinjector' (did you forget to
inherit a required module?)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53)
at com.google.gwt.core.client.GWT.create(GWT.java:98)
at
net.mbc.contentpool.gwt.client.ContentPoolEntryPoint.<init>(ContentPoolEntryPoint.java:35)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:465)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:375)
at
com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:193)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:680)
Caused by: com.google.gwt.core.ext.UnableToCompleteException: (see previous
log entries)
at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:595)
at
com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
at com.google.gwt.core.client.GWT.create(GWT.java:98)
at
net.mbc.contentpool.gwt.client.ContentPoolEntryPoint.<init>(ContentPoolEntryPoint.java:35)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:465)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:375)
at
com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:193)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:680)
DEBUG: Invoking generator com.google.gwt.inject.rebind.GinjectorGenerator.
ERROR: Generator 'com.google.gwt.inject.rebind.GinjectorGenerator'
threw an exception while
rebinding 'net.mbc.contentpool.gwt.client.PooledGinjector'.
java.lang.ClassCastException:
net.mbc.contentpool.gwt.client.PooledGinModule cannot be cast to
com.google.gwt.inject.client.GinModule
at
com.google.gwt.inject.rebind.BindingsProcessor.instantiateGModuleClass(BindingsProcessor.java:471)
at
com.google.gwt.inject.rebind.BindingsProcessor.populateModulesFromInjectorInterface(BindingsProcessor.java:453)
at
com.google.gwt.inject.rebind.BindingsProcessor.createModules(BindingsProcessor.java:426)
at
com.google.gwt.inject.rebind.BindingsProcessor.process(BindingsProcessor.java:236)
at
com.google.gwt.inject.rebind.GinjectorGeneratorImpl.generate(GinjectorGeneratorImpl.java:76)
at
com.google.gwt.inject.rebind.GinjectorGenerator.generate(GinjectorGenerator.java:47)
at
com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48)
at
com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)
at
com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:681)
at
com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
at
com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:74)
at
com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:285)
at
com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:141)
at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:585)
at
com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
at com.google.gwt.core.client.GWT.create(GWT.java:98)
at
net.mbc.contentpool.gwt.client.ContentPoolEntryPoint.<init>(ContentPoolEntryPoint.java:35)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:465)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:375)
at
com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:193)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:680)

Do you have any idea what might go wrong?

Thanks in advance, Mo

googl...@googlecode.com

unread,
Oct 21, 2011, 6:17:32 AM10/21/11
to googl...@googlegroups.com
Comment by moho...@web.de:

Hi, I'm new to GIN, just trying to integrate GIN into an existing maven

project. My problem ist that I get a ClassCastException? when trying to
create my injector in my EntryPoint?:
{{{

private final PooledGinjector injector =
GWT.create(PooledGinjector.class);
}}}

although it looks to me that the injector is of the required type:

{{{

@GinModules(PooledGinModule.class)
public interface PooledGinjector extends Ginjector {

// SimplePanel? getMainPanel();
}

}}}

The exception looks like this:

{{{
ERROR: Deferred binding failed
for 'net.mbc.contentpool.gwt.client.PooledGinjector'; expect subsequent
failures. ERROR: Failed to create an instance
of 'net.mbc.contentpool.gwt.client.ContentPoolEntryPoint' via deferred
binding . java.lang.RuntimeException: Deferred binding failed
for 'net.mbc.contentpool.gwt.client.PooledGinjector' (did you forget to

inherit a required module)

googl...@googlecode.com

unread,
Feb 10, 2012, 9:28:19 PM2/10/12
to googl...@googlegroups.com
Comment by nick....@gmail.com:

SVR, I'm getting that same error.

Jon Gorrono

unread,
Feb 10, 2012, 9:48:06 PM2/10/12
to googl...@googlegroups.com
Do you have

<inherits name="com.google.gwt.inject.Inject"/>

in your gwt application xml?

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

--
Jon Gorrono
PGP Key: 0x5434509D -
http{pgp.mit.edu:11371/pks/lookup?search=0x5434509D&op=index}
GSWoT Introducer - {GSWoT:US75 5434509D Jon P. Gorrono <jpgorrono -
www.gswot.org>}
http{middleware.ucdavis.edu}

googl...@googlecode.com

unread,
Mar 5, 2012, 5:28:46 PM3/5/12
to googl...@googlegroups.com
Comment by saurabh....@gmail.com:

I was going through the sample HigherLower and encountered this line
// TODO we could probably use a generator instead of this nonsense.
in com.google.gwt.gin.higherlower.client.gin.DeckProvider.
May be a dumb question but I would really like to know how I can implement
a generator here.

googl...@googlecode.com

unread,
May 8, 2012, 9:50:45 AM5/8/12
to googl...@googlegroups.com
Comment by saurabh....@gmail.com:

does gin provide autowiring by type?

googl...@googlecode.com

unread,
Jan 17, 2013, 5:54:44 AM1/17/13
to googl...@googlegroups.com
Comment by mtp.tahm...@gmail.com:

I have a problem
I have a GInjector class that has EventBus to SimpleEventBus in Singleton,
When I want to get Instance by @Inject and GInjector.getEventBus() in the
same time (for exmaple in a constructor), I've got two different instance
of EventBus.

What's the problem?

Thanks in advance

For more information:
https://code.google.com/p/google-gin/wiki/GinTutorial

googl...@googlecode.com

unread,
Jan 17, 2013, 6:50:45 AM1/17/13
to googl...@googlegroups.com
Comment by mtp.tahm...@gmail.com:

Regard to the above comment :

===========================================================
public class MyModule extends AbstractGinModule{

@Override
protected void configure() {
bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
}
}
===========================================================
@GinModules(MyModule.class)
public interface MyGinjector extends Ginjector {

EventBus getEventBus();
}
===========================================================

public class MainView {

MyGinjector myGinjector = GWT.create(MyGinjector.class);

public MainView(EventBus eventBus ) {
System.out.println(eventBus);
System.out.println(myGinjector.getEventBus()); // Return two differect
instances, why?
}
}


Cheers

googl...@googlecode.com

unread,
Jan 17, 2013, 9:23:00 AM1/17/13
to googl...@googlegroups.com
Comment by t.broyer:

A Singleton is scoped to a Ginjector instance. The EventBus injected
(injected? I don't see any @Inject there) into the MainView constructor
obviously comes from a distinct Ginjector instance than myGinjector.

googl...@googlecode.com

unread,
Jan 19, 2013, 12:42:51 AM1/19/13
to googl...@googlegroups.com
Comment by mtp.tahm...@gmail.com:

Oh! I'm so sorry Broyer

the correct mainview class :
================================
public class MainView {

MyGinjector myGinjector = GWT.create(MyGinjector.class);

@Inject
public MainView(EventBus eventBus ) {

System.out.println(eventBus);
System.out.println(myGinjector.getEventBus());

// Return two differect instances, why?

}
}
===============================
Is there any solution?
Thanks in advance

For more information:
http://code.google.com/p/google-gin/wiki/GinTutorial

googl...@googlecode.com

unread,
Jan 19, 2013, 2:25:32 AM1/19/13
to googl...@googlegroups.com
Comment by mtp.tahm...@gmail.com:

@broyer
You are right,
I used 2 instance of ginjector,
I found them and make all references to one instance of Ginjector and the
problem was solved.
Thanks a lot.

googl...@googlecode.com

unread,
Mar 20, 2015, 10:11:11 AM3/20/15
to googl...@googlegroups.com
Comment by putuindr...@gmail.com:

The script what? Please explain to me, because I want in depth

http://wdfshare.blogspot.com
Reply all
Reply to author
Forward
0 new messages