Why my @Singleton doesn't work?

2009-10-26 Thread eric
Hi, I met a problem when trying @Singleton of Guice: import com.google.inject.Singleton; @Singleton public class ConfigManager { private String data; public void setData(String data) { this.data = data; } public String getData(){ return this.data; } pub

Re: Why my @Singleton doesn't work?

2009-10-26 Thread Stuart McCulloch
2009/10/26 eric > > Hi, I met a problem when trying @Singleton of Guice: > > import com.google.inject.Singleton; > > @Singleton > public class ConfigManager { >private String data; > >public void setData(String data) { >this.data = data; >} > >public String getData(){ >

Re: Why my @Singleton doesn't work?

2009-10-26 Thread eric
Understand, thank you On Oct 26, 5:03 pm, Stuart McCulloch wrote: > 2009/10/26 eric > > > > > > > Hi, I met a problem when trying @Singleton of Guice: > > > import com.google.inject.Singleton; > > > @Singleton > > public class ConfigManager { > >    private String data; > > >    public void set

Re: Why not use ClassLoaders instead of Guice?

2009-10-26 Thread Richard Nichols
If the only problem you are trying to solve is testing of singletons, then Guice doesn't offer you much advantage. Remember that Guice is primarily designed to make implementation of dependency injection simpler, and that's a design pattern which will affect your entire code base, if your code is

Re: Why not use ClassLoaders instead of Guice?

2009-10-26 Thread Gili Tzabari
... but in practice, how often does that actually happen? It sounds to me like dependency injection is mostly about testability, not code reuse, and to that end ClassLoaders are actually less complex than all the hoopla that Guice does under the hood (hint: Guice uses ASM which uses b

Re: Why not use ClassLoaders instead of Guice?

2009-10-26 Thread Stuart McCulloch
2009/10/26 Gili Tzabari >... but in practice, how often does that actually happen? It sounds > to > me like dependency injection is mostly about testability, not code > reuse, and to that end ClassLoaders are actually less complex than all > the hoopla that Guice does under the hood (hint

Re: Why not use ClassLoaders instead of Guice?

2009-10-26 Thread Endre Stølsvik
On Mon, Oct 26, 2009 at 14:55, Gili Tzabari wrote: > > >... but in practice, how often does that actually happen? It sounds > to > me like dependency injection is mostly about testability, not code > reuse, and to that end ClassLoaders are actually less complex than all > the hoopla that

Re: Why not use ClassLoaders instead of Guice?

2009-10-26 Thread Gili Tzabari
Stuart McCulloch wrote: > 2009/10/26 Gili Tzabari > > >... but in practice, how often does that actually happen? It > sounds to > me like dependency injection is mostly about testability, not code > reuse, and to that end ClassLoaders are ac

Re: Why not use ClassLoaders instead of Guice?

2009-10-26 Thread Brian Pontarelli
On Oct 26, 2009, at 9:59 AM, Gili Tzabari wrote: > > Stuart McCulloch wrote: >> 2009/10/26 Gili Tzabari > > >> >> ... but in practice, how often does that actually happen? >> It >>sounds to >>me like dependency injection is mostly about testabil

Re: Why not use ClassLoaders instead of Guice?

2009-10-26 Thread Stuart McCulloch
2009/10/26 Gili Tzabari > > Stuart McCulloch wrote: > > 2009/10/26 Gili Tzabari > > > > > >... but in practice, how often does that actually happen? It > > sounds to > > me like dependency injection is mostly about testability, not code > >

Re: Why not use ClassLoaders instead of Guice?

2009-10-26 Thread Bob Lee
Gili, On Mon, Oct 26, 2009 at 6:55 AM, Gili Tzabari wrote: > It sounds to > me like dependency injection is mostly about testability, not code > reuse DI is about flexibility, less boilerplate, and code reuse. Testability falls out of that. We use tests in examples because they illustrate the b

Spring integration with Guice with interface and implementations separately

2009-10-26 Thread Eelco Hillenius
Hi, I'm looking for advice on how to best integrate Spring with Guice. Basically, I want to be able to use Spring managed modules with Guice managed ones. Guice Spring does that, but the implementation is a bit simplistic. Particularly, the (very typical) case where you'd define the implementing

How to apply patch?

2009-10-26 Thread eric
I've met the java.lang.NoClassDefFoundError: com/google/inject/ internal/cglib/reflect/FastClass problem which has been disscussed in http://code.google.com/p/google-guice/issues/detail?id=343. Could anyone please tell me how to apply the patch? or is there any daily build that I can use directly?

Re: How to apply patch?

2009-10-26 Thread Stuart McCulloch
2009/10/27 eric > > I've met the java.lang.NoClassDefFoundError: com/google/inject/ > internal/cglib/reflect/FastClass problem which has been disscussed in > http://code.google.com/p/google-guice/issues/detail?id=343. > Could anyone please tell me how to apply the patch? or is there any > daily b

Re: How to apply patch?

2009-10-26 Thread eric
Thanks so much, Stuart. On Oct 27, 11:53 am, Stuart McCulloch wrote: > 2009/10/27 eric > > > > > I've met the java.lang.NoClassDefFoundError: com/google/inject/ > > internal/cglib/reflect/FastClass problem which has been disscussed in > >http://code.google.com/p/google-guice/issues/detail?id=34