This particular service could have just as easily been a pojo.  I'm converting 
a tapestry4/spring application to tapestry5 and I'm trying to leave spring 
behind.  As a spring bean this object was simply declared with 
scope="prototype"  which gave me a new instance of the object every time I 
accessed it.

It does look like autobuild will do what I need.   I'll give it a try.

Thank you very much.
Tony


On Oct 12, 2011, at 5:21 PM, Cezary Biernacki wrote:

> Hi,
> you can inject ObjectLocator and call 'autobuild' to create a new instance
> when needed. So instead of
> 
> @Inject private MyService myService;
> ...
> myService.doSomething();
> 
> you would have
> @Inject private ObjectLocator locator;
> 
> ....
> locator.autobuild(MyService.class).doSomething().
> 
> 
> However I am not sure if your design is correct - do you need really to save
> state in the service? It does not look like a proper service.
> 
> Best regards,
> Cezary
> 
> 
> On Wed, Oct 12, 2011 at 11:11 PM, Tony Nelson <tnel...@starpoint.com> wrote:
> 
>> I have a service, that I need a new instance of every time it is
>> referenced.  In ScopeConstants I see DEFAULT, and PERTHREAD.  I really need
>> a new instance every time I request this particular service because it saves
>> state, and yes, there are some occasions where I need several of these in
>> the same thread (web request).
>> 
>> For now, I can change all of my references to the service to a new
>> instantiation of the implementing class, but that really isn't ideal.
>> 
>> Does anyone have any idea how difficulty this type of change might be, and
>> if it might be possible to get it into a 5.3-beta?
>> 
>> Thanks
>> Tony
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
>> 


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

Reply via email to