On 01/25/2012 02:47 PM, Bill Burke wrote:
>
>
> On 1/25/12 5:13 AM, Marek Potociar wrote:
>> - Should we drop DI and once new CDI extension API is finalized, should we focus more on CDI instead?
>>
>
> Yes ditch 330, CDI is a much more of a thought out, rich API and interface. BTW, AFAIK, DI can't handle parameter
> injection. @Inject isn't even parameter scoped. So I don't see why we should mix the two until that is at least
> resolved. Also, I"m not sure, but I don't think CDI supports parameter injection either.
Just to clarify on method parameter injection support in DI/CDI:
Of course, both DI and CDI support method parameter injection. It's just that you don't have to repeat the injection
annotation with each parameter. (Obviously there is no language facility in Java that would let you call a method where
you would specify only subset of the method parameters and let the injection provider specify the rest. So if you inject
a method, you need to inject all parameters.) I think you are hitting this topic with your earlier question about making
@Context in method parameters optional.
>
> BTW, IMO, JSR-330 was a purely political JSR just to satisfy two companies that aren't even Java EE providers. One of
> which attacks Java EE repeatedly as a cornerstone of their business, they other one is currently being sued by Oracle.
> You can guess who these companies are.
>
While JAX-RS is a Java EE spec, it was from the very beginning (AFAIK) designed to be only loosely coupled with EE
environment. We see many users that use Jersey outside EE container (yes, together with Guice or Spring :) ). So while I
agree that splitting JSR-299 and JSR-330 was a political game, I'd say that better integration with JSR-330 would have a
positive practical impact on a number of JAX-RS users.
For instance, give the fact that there is a standard injection annotation in Java SE that is adopted by both DI and CDI,
the custom JAX-RS @Context seems somewhat old-fashioned at this point.
Please note that I am writing the above just to clarify the parameter injection FUD and to explain the potential
benefits of supporting JSR-330. I am not trying to push for JSR-330 integration into JAX-RS 2.0 at this point though.
Marek