You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Gaetan Zoritchak <g....@moncoachfinance.com> on 2012/02/07 16:08:37 UTC
Injection in a Resource
Hi all,
I use guice in my applications. I need to inject some code (service) in a
DynamicImageResource. It is not straightforward because a Resource is not a
component.
Does anybody has already done that? What would be the best way?
Thanks in advance,
Re: Injection in a Resource
Posted by Gaetan Zoritchak <g....@moncoachfinance.com>.
Thanks for that quick answer.
2012/2/7 Carl-Eric Menzel <cm...@wicketbuch.de>
> On Tue, 7 Feb 2012 16:08:37 +0100
> Gaetan Zoritchak <g....@moncoachfinance.com> wrote:
>
> > Hi all,
> >
> > I use guice in my applications. I need to inject some code (service)
> > in a DynamicImageResource. It is not straightforward because a
> > Resource is not a component.
> >
> > Does anybody has already done that? What would be the best way?
>
> You can call the Injector directly in your constructor:
>
> Injector.get().inject(this);
>
> The effect is the same as in Components: It will inject all your
> annotated fields.
>
> Carl-Eric
> www.wicketbuch.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Injection in a Resource
Posted by Carl-Eric Menzel <cm...@wicketbuch.de>.
On Tue, 7 Feb 2012 16:08:37 +0100
Gaetan Zoritchak <g....@moncoachfinance.com> wrote:
> Hi all,
>
> I use guice in my applications. I need to inject some code (service)
> in a DynamicImageResource. It is not straightforward because a
> Resource is not a component.
>
> Does anybody has already done that? What would be the best way?
You can call the Injector directly in your constructor:
Injector.get().inject(this);
The effect is the same as in Components: It will inject all your
annotated fields.
Carl-Eric
www.wicketbuch.de
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org