users@jsr311.java.net

Re: sub resource locators & generating urls

From: Jo Størset <jo.storset_at_usit.uio.no>
Date: Tue, 8 Jul 2008 14:15:33 +0200

Den 8. juli. 2008 kl. 14.07 skrev Stephan Koops:

> Hi Marc
>
>>>> [...] Dependencies are only injeced in classes instantieated by
>>>> the runtime. Marc answered a reason I think, but I didn't know
>>>> the reason yet. I also think it is useful to allow this injection.
>>> I guess it simply is a necessary trade off that had to be made?
>> The main issue is that the application is in charge of the returned
>> object's lifecycle so its hard to know when its desirable to inject
>> and when not.
> I see now reason when not to inject. If it is a singelton, where the
> runtime should not inject, than IMO the developer should not
> annotate methods or fields with @Context. And if something is
> injected, it IMO doesn't matter, if the objects are injected again.

Singletons might also need to get things like the base url builder?
Maybe the 'singleton' and the non singleton context stuff should have
been split?

Another suggestion - what if the sub resource locator returns a class?
Then the sub resource locator only specifies the resource to use,
leaving the instantiation to the container?

Jo