provider methods can't bind eager singletons
See original GitHub issueFrom medotin on June 25, 2008 09:39:59
We need an @
Eager or something for provider methods.
_Original issue: http://code.google.com/p/google-guice/issues/detail?id=216_
Issue Analytics
- State:
- Created 9 years ago
- Reactions:7
- Comments:17 (1 by maintainers)
Top Results From Across the Web
Binding @Provides method as eager singleton - Stack Overflow
In the bug report you linked, "provider methods" means "methods annotated with @Provides". So you're right, it's not directly possible. But ...
Read more >Re: Issue 216 in google-guice: provider methods can't bind eager ...
Comment #10 on issue 216 by joshbb...@gmail.com: provider methods can't bind eager singletons http://code.google.com/p/google-guice/issues/detail?id=216 Why ...
Read more >Dagger - Square Open Source
Classes that lack @Inject annotations cannot be constructed by Dagger. ... Annotate an @Provides method or injectable class with @Singleton .
Read more >Eager singletons - Java 9 Dependency Injection [Book] - O'Reilly
Eager singletons Guice provides special syntax for making an object that has the singleton scope, and is initialized to eager mode rather than...
Read more >How to bind one implementation to multiple interfaces?
To be clear, do I need to use the Provider approach if I want a single ... bind to both (and not one...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
use spring 😉
Folks, please be kind to each other.
As for the question at hand, there’s no built-in to do what you want exactly. You can workaround the problem by introducing an @EagerSingleton annotation, having it delegate to Singleton scope, and manually iterating through bindings in the injector and eagerly instantiating bindings that are eager singletons.