You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by peibel <p....@ibermatica.com> on 2009/01/26 17:21:29 UTC

How to inject Tapestry Objects in a thread

Hi,

Can someone help us?

We have a tapestry 5 application and we need add a thread because of new
requirements.

We'd like to inject some tapestry objects in a our application -
HibernateSessionManager etc. - to get access to our database from the new
thread. 

Is it possible? are we misunderstanding anything?

Thanks!
 
-- 
View this message in context: http://www.nabble.com/How-to-inject-Tapestry-Objects-in-a-thread-tp21668380p21668380.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: How to inject Tapestry Objects in a thread

Posted by Francois Armand <fa...@linagora.com>.
peibel wrote:
> Hi,
>
> Can someone help us?
>
> We have a tapestry 5 application and we need add a thread because of new
> requirements.
>
> We'd like to inject some tapestry objects in a our application -
> HibernateSessionManager etc. - to get access to our database from the new
> thread.
>   

You can inject Tapestry service only on other Tapestry-ioc managed 
service, it's the way all IOC framework work: then can handle only 
object in their scope (in particular, they have to manage the object 
creation to be able to refer to the good existing object instance that 
should be injected).

So, two cases :
- your new thread is next to your T5 app : T5 can't do anything for you 
- neither could Guice, or Spring
- by "a new Thread", you mean a new object (service) that should be 
thread-dependent. In this case, you could manage it's creation with T5 
and the "per thread scope", and in this case, you would be able to fully 
use T5 IoC and so, inject other service into it.

For service scoping, see : 
http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html

I hope it helps, and perhaps I misunderstood something, so don't 
hesitate to ask precisions.

-- 
Francois Armand
Etudes & Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
-----------
http://fanf42.blogspot.com
InterLDAP - http://interldap.org 
FederID - http://www.federid.org/
Open Source identities management and federation


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