You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chung Khanh Duy <ch...@gmail.com> on 2014/07/28 04:47:25 UTC
What is difference between @Inject and @InjectComponent since we
declare it before component.
Hi experts,
I have a snippet code as below:
@Inject
private Zone tZone;
@InjectComponent
private Zone tZone;
So I don't understand what is difference if I use @Inject or
@InjectComponent for component in Tapestry ? If anyone knows, can you
please let me know why. I really appreciate.
Thanks,
Duy.
Re: What is difference between @Inject and @InjectComponent since we
declare it before component.
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Sun, 27 Jul 2014 23:47:25 -0300, Chung Khanh Duy
<ch...@gmail.com> wrote:
> Hi experts,
Hi!
> I have a snippet code as below:
>
> @Inject
> private Zone tZone;
This is declaring a component instance. This supposes you just use <div
t:id="tZone"> in the template. I used div as an example, but any tag is
valid.
> @InjectComponent
> private Zone tZone;
This is just injecting a component declared in the template.
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: What is difference between @Inject and @InjectComponent since we
declare it before component.
Posted by Chung Khanh Duy <ch...@gmail.com>.
Hi Lance,
Many Thanks! Your explanation is clear.
Duy.
On Mon, Jul 28, 2014 at 3:01 PM, Lance Java <la...@googlemail.com>
wrote:
> The following applies to components only, not services.
>
> @Inject is backed by InjectWorker which ultimately delegates to
> InjectionProvider2. InjectionProvider2 is a chain which can be contributed
> to. See TapestryModule.provideStandardInjectionProviders() for the
> defaults. Some of the notable options for @Inject are assets, blocks and
> services but you can provide your own.
>
> @InjectComponent can only inject components by id (see
> InjectComponentWorker).
>
--
Chung Khánh Duy
Project Support Manager
Formos
Re: What is difference between @Inject and @InjectComponent since we
declare it before component.
Posted by Lance Java <la...@googlemail.com>.
The following applies to components only, not services.
@Inject is backed by InjectWorker which ultimately delegates to
InjectionProvider2. InjectionProvider2 is a chain which can be contributed
to. See TapestryModule.provideStandardInjectionProviders() for the
defaults. Some of the notable options for @Inject are assets, blocks and
services but you can provide your own.
@InjectComponent can only inject components by id (see
InjectComponentWorker).