Guice injecting empty String unexpectedly

2008-10-28 Thread Andrew Clegg
Maybe I'm doing something stupid, but what's wrong with this picture: // In my module RealServicesModule bind( String.class ).annotatedWith( FuncNetVersionDependent.class ).toInstance( "http://cathdb.info/FuncNet_0_1/"; ); // A static member in my test class @Inject @FuncNetVersi

Re: Guice injecting empty String unexpectedly

2008-10-28 Thread Andrew Clegg
PS This is using old-skool Guice 1.0 release, I'm hesitant to upgrade while I'm still learning, but if this is a known issue then I can... Cheers. Andrew. 2008/10/28 Andrew Clegg <[EMAIL PROTECTED]>: > Maybe I'm doing something stupid, but what's wrong with this picture: > > > // In my module R

Re: Guice injecting empty String unexpectedly

2008-10-28 Thread Robbie Vanbrabant
You have to create the injector @BeforeClass gets called, and you need to use requestStaticInjection in you modules for the classes in which you want to inject statics. But if you're trying to unit test with Guice, you could also have a look at one of the projects that help you with that, like Guic

Re: Guice injecting empty String unexpectedly

2008-10-28 Thread Andrew Clegg
2008/10/28 Robbie Vanbrabant <[EMAIL PROTECTED]>: > You have to create the injector @BeforeClass gets called, and you need to You mean initialize it as a static member itself or something? private static Injector injector = Guice.createInjector( new RealServicesModule() ); Then do the @BeforeCl

Re: Guice injecting empty String unexpectedly

2008-10-28 Thread Bob Lee
On Tue, Oct 28, 2008 at 8:46 AM, Andrew Clegg <[EMAIL PROTECTED]>wrote: > PS This is using old-skool Guice 1.0 release, I'm hesitant to upgrade > while I'm still learning, but if this is a known issue then I can... > This is a known issue, one of the very few in 1.0. I'd stick with 1.0 until you'