users@jsr311.java.net

Re: sub resource locators & generating urls

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 08 Jul 2008 14:55:50 +0200

On Jul 8, 2008, at 2:07 PM, Stephan Koops wrote:

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

But then you run into issues when you want to use a resource class as
both a root and sub resource...

Marc.

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.