简体   繁体   中英

How to import com.google.inject.Singleton?

I am learning Gin with GinTutorial and I've stacked on silly problem.

In bind(MyWidgetMainPanel.class).in(Singleton.class); Singleton does not exist.

I've already tried the following:

import com.google.gwt.inject.client.AbstractGinModule; import com.google.gwt.inject.client.Singleton; import com.google.gwt.inject.Singleton;

IDE shows that Singleton does not exist before compilation time.

If I try to use import com.google.inject.Singleton; it shows that Singleton does not exist on compilation.

  • gin-2.1.2
  • gwt2.6

I'd be happy to have any of your ideas or explanations.

I am not sure this is the solution, but when I use injection like this with GIN in GWT, I do not import com.google.gwt.inject.Singleton in my GinModule, but com.google.inject.Singleton and it works. I hope it helps.

Finally I've found that it is not enough to add gin-2.1.2.jar to classpath. It requires guice-3.0.jar .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM