Hi,

  I found the problem. It is because wicket-guice library creates a
proxy of every @inject attribute and uses a locator to get the
instance. The main problem consist in the algorithm of this locator,
it makes something like this:

- keeps a reference to a possible BindingAnnotation (Named for example)
- keeps a reference to the field type (String.class for example)
- generates a key = Key.get(TypeLiteral.get(String.class), annotation.class);
- calls injector.getInstance(key);

So, the information about the optional @Inject parameter is lost. I
took a look in the google-guice source code trying to find a solution
for this problem but it stills complex for me (I'm new to guice). I
realized that
it should use the same algorithm of SingleFieldInjector (member
injection). I saw that the most part of guice classes are not public.
Do you have any suggestions? Do you mind some way to get the bound
value with the Class definition + field definition?

Thanks anyway,
Eduardo S. Nunes

On Thu, Apr 23, 2009 at 10:07 PM, Eduardo Nunes <[email protected]> wrote:
> I tried to reproduce it in a test case but I couldn't. I think the
> error is inside wicket-guice library. This is part of the stacktrace:
>
> Caused by: com.google.inject.ConfigurationException: Guice configuration 
> errors:
>
> 1) No implementation for java.lang.String annotated with
> @com.google.inject.name.Named(value=SignOutPage.redirectPage) was
> bound.
>  while locating java.lang.String annotated with
> @com.google.inject.name.Named(value=SignOutPage.redirectPage)
>
> 1 error
>        at com.google.inject.InjectorImpl.getProvider(InjectorImpl.java:784)
>        at com.google.inject.InjectorImpl.getInstance(InjectorImpl.java:789)
>        at 
> org.apache.wicket.guice.GuiceProxyTargetLocator.locateProxyTarget(GuiceProxyTargetLocator.java:67)
>        at 
> org.apache.wicket.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.java:129)
>        at 
> org.apache.wicket.guice.GuiceComponentInjector.inject(GuiceComponentInjector.java:114)
>        at 
> org.apache.wicket.guice.GuiceComponentInjector.onInstantiation(GuiceComponentInjector.java:196)
>        at 
> org.apache.wicket.Application.notifyComponentInstantiationListeners(Application.java:1027)
>
> On Wed, Apr 22, 2009 at 12:52 AM, [email protected] <[email protected]> wrote:
>>
>> I couldn't reproduce this. Could you try again with the latest
>> snapshot?
>> http://code.google.com/p/google-guice/downloads/list
>>
>> If you can get it to fail reliably, please send a JUnit test case.
>>
>> Cheers,
>> Jesse
>>
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
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