dev@glassfish.java.net

Re: Using jsr 330 annotations in GlassFish modules

From: Sahoo <sanjeeb.sahoo_at_oracle.com>
Date: Fri, 10 Feb 2012 19:14:51 +0530

Since the injection of a provider will happen earlier than where it is
being looked up today, which of the following will be behavior at the
time of injecting a provider if there is actually no inhabitant which
can satisfy the requirement?

a) does a proxy provider get injected which might return null when get()
is called if there is still no suitable inhabitant available?
b) a null object is injected?
c) an UnsatisfiedDependencyException is thrown?

I suppose #a. Could you confirm?

Thanks,
Sahoo
On Wednesday 08 February 2012 07:57 PM, John Wells wrote:
> In the cases I have looked at these classes would have been loaded in
> any case, since they were used either as parameters to methods or
> return types from methods. In other cases, it is possible we may want
> to back off if we find classes where doing this refactoring would lead
> to earlier class loading.
>
> The largest benefit of this refactoring IMO is to move glassfish away
> from proprietary HK2 API and to the standard JSR-330 based API.
>
> On 2/8/2012 8:27 AM, Sahoo wrote:
>> On Wednesday 08 February 2012 05:16 PM, John Wells wrote:
>>> On the other hand, if it is the early loading of the class due to
>>> the inclusion of the type in the parameterized type, then you could
>>> be correct in that the class will get loaded earlier than it was
>>> before.
>> That's exactly what was my concern.
>>
>> One thing I wanted to ask though about this exercise. What benefit
>> does all these refactoring bring to the code base?
>>
>> Sahoo