You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Travis Klotz <tr...@gmail.com> on 2005/07/08 21:46:30 UTC

Re: When is injected object created?

The constructor is called when the class is actually instantiated by
the JVM.  I really can't imagine there is any way to hook something
instance specific in before the constructor is called.

Travis Klotz

On 7/8/05, Adam Czysciak <ad...@gmail.com> wrote:
> Hi,
> 
>   I @InjectObject, the spring bean. When is it created? When I access the
> getter in constructor, I get null. When I access it later, I get the bean
> correctly. Is there any way the bean can be initialized before the
> constructor begins?
> 
> --
> Greets,
>   Adam Czysciak
>   adam.czysciak@gmail.com
>   Sun Certified Programmer for the Java 2 Platform, SE 5
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: When is injected object created?

Posted by Adam Czysciak <ad...@gmail.com>.
Travis Klotz wrote:

> The constructor is called when the class is actually instantiated by
> the JVM.  I really can't imagine there is any way to hook something
> instance specific in before the constructor is called.
Sure, I certainly know when constructor is called. Anyway, I did't know how
Tapestry class enhancement works - I thought it might change the annotation
to a field or sth like that.

But I checked it - the injected properties are given to the constructor of
generated subclass. Besides - the @InjectObject is followed by an abstract
method, therefore it's body is in generated subclass. So - it's not
accessible yet in base class, as subclass's constructor is not called yet.

Hm, answered myself... but maybe someone in the future might want to read
this thread.

-- 
Greets,
  Adam Czysciak
  adam.czysciak@gmail.com
  Sun Certified Programmer for the Java 2 Platform, SE 5


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org