On Tue, 31 May 2011 13:39:50 -0300, Erik Fäßler <erik.faess...@uni-jena.de> wrote:

  Hey all,

Hi!

I have a service which is filled with data at one class (some random Java class, no page). Then, in another class, I'd like to retrieve the service and get the data. I do it this way because quite a lot of objects are involved with the service and I wanted to take advantage by Tapestry's pooling so I wouldn't have to create all these objects again and again.

Tapestry-IoC doesn't pool service instances. Before 5.2, Tapestry (the web framework, not the IoC one) pooled pages instances, but 5.2 doesn't.

But when I try to re-take the service in the other class I get another instance, thus I don't have access to the data.

How is this second class getting the service object? If the service is singleton (this is the default scope in Tapestry-IoC), the same service instance is injected. Don't forget that both classes need to be Tapestry-IoC services for them to have service injection.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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

Reply via email to