You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Edgar Merino <do...@gmail.com> on 2008/10/16 12:11:24 UTC
More guice serialization problems
Hello once again,
wicket-guice integration has been working good for me, but I needed
to get some injected services in classes that were not Components, so I did:
Injector injector = ( (GuiceInjectorHolder)
RequestCycle.get().getApplication().getMetaData(GuiceInjectorHolder.INJECTOR_KEY)).getInjector();
injector.injectMembers(this);
This arises serialization problems with the Guice injector, although
I'm not keeping a reference to the injector... this should be because
the actual injected service is not handled by a wicket ioc proxy. Igor
suggested salve, I've been doing some reading about it but haven't try
it yet, but wouldn't it just throw the same exception when using salve
since it's not a proxy either? or maybe this won't happen because salve
would inject a local dependency (inside a method) when needed? can
anyone clarify this for me (and maybe many others with the same doubt)?
Thanks again for the help,
Edgar Merino
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: More guice serialization problems
Posted by Igor Vaynberg <ig...@gmail.com>.
salve removes fields and performs just in time lookup of the dependency. so
no serialization errors and your instances take up less ram.
as far as wicket's guice support goes you should really do this
InjectorHolder.getInjector().inject(this) - this will inject proxies instead
of actual dependencies.
-igor
On Thu, Oct 16, 2008 at 3:11 AM, Edgar Merino <do...@gmail.com> wrote:
> Hello once again,
>
> wicket-guice integration has been working good for me, but I needed to
> get some injected services in classes that were not Components, so I did:
>
> Injector injector = ( (GuiceInjectorHolder)
> RequestCycle.get().getApplication().getMetaData(GuiceInjectorHolder.INJECTOR_KEY)).getInjector();
> injector.injectMembers(this);
>
> This arises serialization problems with the Guice injector, although I'm
> not keeping a reference to the injector... this should be because the actual
> injected service is not handled by a wicket ioc proxy. Igor suggested salve,
> I've been doing some reading about it but haven't try it yet, but wouldn't
> it just throw the same exception when using salve since it's not a proxy
> either? or maybe this won't happen because salve would inject a local
> dependency (inside a method) when needed? can anyone clarify this for me
> (and maybe many others with the same doubt)?
>
> Thanks again for the help,
> Edgar Merino
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>