Re: How to share the same Singleton instance through multiple injectors/modules

2011-12-02 Thread Stuart McCulloch
On 2 December 2011 14:31, Noctarius wrote: > You can use: > > Foo foo = new FooImpl(); > bind(Foo.class).toInstance(foo); > > This is an implicit singleton and you can use the same instance for > multiple injectors. Alternativly you can use ChildInjectors. > One thing to watch out for with "bind

Re: creating a community of 3rd parties integrations

2011-12-02 Thread Simone Tripodi
Hi all again sorry for resurrecting zombies, but this last message just to let you know the direction that CDI people has taken[1] - it is similar to my proposal, with the difference they have a community :) Simo [1] http://wiki.apache.org/incubator/DeltaSpikeProposal http://people.apache.org/~si

Re: How to share the same Singleton instance through multiple injectors/modules

2011-12-02 Thread Noctarius
You can use: Foo foo = new FooImpl(); bind(Foo.class).toInstance(foo); This is an implicit singleton and you can use the same instance for multiple injectors. Alternativly you can use ChildInjectors. Cheers Noc Am 02.12.2011 15:00, schrieb Sandro Munda: > The @Singleton scope does not refer to

How to share the same Singleton instance through multiple injectors/modules

2011-12-02 Thread Sandro Munda
The @Singleton scope does not refer to the Singleton pattern. According to the "Dependency Injection" book of "Dhanji" : "Very simply, a singleton’s context is the injector itself. The life of a singleton is tied to the life of the injector. Therefore, only one instance of a singleton is ever