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
>
>

Reply via email to