howto: eager singleton using provider methods

557 views
Skip to first unread message

med...@gmail.com

unread,
Jun 24, 2008, 7:17:56 PM6/24/08
to google-guice
@Provides @Singleton will create a singleton, but there is no @Eager.
Is it possible currently? Thanks.

limpb...@gmail.com

unread,
Jun 24, 2008, 9:22:24 PM6/24/08
to google-guice
On Jun 24, 4:17 pm, "medo...@gmail.com" <medo...@gmail.com> wrote:
> @Provides @Singleton will create a singleton, but there is no @Eager.
> Is it possible currently? Thanks.
No.

But if you create your injector in Stage.PRODUCTION, then
all singletons will be created eagerly regardless.

med...@gmail.com

unread,
Jun 25, 2008, 9:45:23 AM6/25/08
to google-guice
Yep that's true. I've filed an issue for this here:
http://code.google.com/p/google-guice/issues/detail?id=216

I submitted it as a defect on accident, but am unable to change it to
enhancement. I am the reporter, yet don't have change permission on
it Bizzzaaarrro
Reply all
Reply to author
Forward
0 new messages