<http://stackoverflow.com/questions/34464489/return-singleton-queuet-in-guice#>
I am using Google Guice for dependency injection and I require a singleton
Queue<T>.
Here is the code to return the queue.
bind(
new TypeLiteral<Queue<Entity>>() { }
).annotatedWith(OurBulletQueue.class).to(
new TypeLiteral<ArrayDeque<Entity>>() { }
).asEagerSingleton();
But obviously it is not returning me a singleton due to some odd reason (My
Guess is because I am binding it to new TypeLiteral). Any idea on how to
fix it or is there any better way to do it?
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-guice/86f266dc-16a9-4301-bc20-2d5138d04c63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.