users@javaee-spec.java.net

[javaee-spec users] Re: [jsr342-experts] Re: CDI positioning

From: Pete Muir <pmuir_at_bleepbleep.org.uk>
Date: Mon, 3 Sep 2012 13:42:55 +0100

Hi Santiago

On 31 Aug 2012, at 21:47, Bill Shannon wrote:

> santiago.pericasgeertsen_at_oracle.com wrote on 08/31/12 13:26:
>> Hi Pete,
>>
>> Just to be clear, is this your suggestion?
>>
>> (i) Deprecate @Context and related classes (like ContextResolver) in
>> JAX-RS. These have been there since JAX-RS 1.X, likely before CDI was
>> finalized. Of course, deprecation means that JAX-RS 2.0 implementations
>> will still need to support them for backward compatibility.

Sorry, I wasn't clear (and also mixed up conversations).

I wouldn't advocate deprecating @Context at this point, as it's already in JAX-RS, and I don't think users would appreciate this change. I've talked to Bill Burke about this, and it might be interesting to explore whether @Context could be implemented on top of CDI... But this isn't a priority I think!

My statement is more forward looking. If we were adding JAX-RS 1.0 today, and it had a need of something like @Context, then I would suggest not adding it, but instead using @Inject @Context or something like that, so that the programming model is aligned for the whole platform.

However I do know JAX-RS is thinking about adding more injection constructs into 2.0, and I think that is a mistake.

> Whether they're formally deprecated is a separate question. We've
> seen that lots of developers don't like us to deprecate things that
> work perfectly well. We may just want to steer people towards a
> different approach using CDI while leaving the existing APIs unchanged.

+1

>
>> (ii) Have JAX-RS 2.0 define a small subset of CDI for non-EE
>> environments. And carefully list the caveats of porting a JAX-RS EE
>> application into a non-EE environment.
>
> I don't think we're planning to subset CDI. The decision to be made
> is whether the dependency on CDI is hard or soft. If soft, JAX-RS would
> work without CDI, but some things might have to be done in a less
> convenient way.

Yes, unfortunately we aren't in a position today to specify that subset in CDI, but this is definitely something we want to do in the future.

I also don't think you need to specify the CDI subset, but instead specify how you expect your annotations to work if CDI is present or not.

I would be very happy to work with you and Marek and look at if/where there is overlap. Just drop me an email and we can work out a time.

HTH

>
>> I'm not sure what you mean by the statement: "and JAX-RS is fully
>> functional without injection,". JAX-RS actually depends very heavily on
>> injection. I may be missing some context here.
>
> Are there objects that can only be acquired using injection, and can't
> be acquired any other way?