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

From: Santiago Pericas-Geertsen <>
Date: Fri, 31 Aug 2012 17:12:04 -0400

On Aug 31, 2012, at 4:47 PM, Bill Shannon wrote:

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

 I'm not sure I fully understand the soft case. Less convenient for the developer or the JAX-RS implementor?

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

 Yes, many. First, JAX-RS does HTTP request binding using annotations like @HeaderParam, @CookieParam, etc. I think all these are akin to qualified injections in CDI. Second, specifically about @Context injection, there are several framework-provided context objects that are only accessible via injection, things like UriInfo, Headers, Providers, SecurityContext, etc. In either case, injection can be in constructors, fields, properties and resource method parameters.

-- Santiago