jsr345-experts@ejb-spec.java.net

[jsr345-experts] How to handle ambiguity on _at_EJB injection?

From: Carlo de Wolf <cdewolf_at_redhat.com>
Date: Tue, 30 Oct 2012 09:52:03 +0100

I would like to enter a feature request similar to CDIs handling of
ambiguous dependencies [1].

With a statement of:

     @EJB BeanInterface bean;

multiple EJBs might be eligible for injection.

As long as the environment onto which the application is deployed does
not change, the actual injection will likely stay the same every time it
is performed. However should, for example, a JDK version be updated or
another JDK implementation be used. The actual injection might change.

So I would rather see that EJB 3.2 EDR 16.5.2 be updated that an
Application Assembler must ensure each EJB reference resolves to a
single EJB. If not, it would be construed as a deployment error (in the
likes of AmbiguousResolutionException).

This should be entered as a feature request as it would break backwards
compatibility. Alternatively we could just demand a warning be logged.

Anybody opposed to having an 'AmbiguousResolutionException'?

Carlo

[1] CDI 1.0 FR 5.2.1 Unsatisfied and ambiguous dependencies