I do not know the answer to your question. However, you could put @Singleton
on your classes. "Marking" singleton classes with @Singleton is not a bad
practice anyway.


Jeremy,


On Thu, Jan 7, 2010 at 9:48 AM, Andrey <[email protected]> wrote:

> Hello!
>
> How can I make Guice create singletons by default?
>
> At the moment ALL my classes are injected as singletons so if it was
> default scope I could remove all such lines from the module:
>
> bind(ProductsController.class).in(Singleton.class);
> bind(ProductService.class).in(Singleton.class);
> ...
>
> Look at the Spring for example - singleton is the default scope in
> Spring and it is correct, because we usually use injection for high
> level services, controllers and other singletons. If we need new
> instance every time we just use new, we do not usually need IOC for
> that. So it is very strange for me that Guice's default scope is
> "new".
> Can I change this?
>
> Thanks in advance!
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-guice%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>
>
>
>


-- 
Jeremy Chone
+1 415 699 9912
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.

Reply via email to