users@glassfish.java.net

Is there one place in application.xml where I can override EJB references?

From: Laird Nelson <ljnelson_at_gmail.com>
Date: Fri, 26 Jul 2013 09:43:08 -0700

I have a large .ear file.

It has dozens of ejb-jars in it with dozens of EJBs in each ejb-jar file.

Each EJB in each of those jars has several @EJB-annotated fields
designating places where other EJBs should be injected.

Up until now there has always been one EJB that matches any given injection
point. Stuff Just Works.

I now have to introduce a couple more ejb-jar files that contain new EJBs
that might ALSO match some of those injection points.

So there are some injection points where there are at least two candidate
EJBs that could fit the bill for injection. Obviously I have to
disambiguate those references.

Now, I know that I could go through each ejb-jar file and edit its
ejb-jar.xml file and carefully put in the requisite XML overrides for each
such injection point. I could also chew my own arm off.

Is there any way to do this at the application.xml level, once? That is,
"Hey, GlassFish or other Java EE container: if you encounter an @EJB
reference with a type of FooManager anywhere down inside this app's guts,
please use this bean implementation from within the app instead",
application-wide?

I noticed that the application.xml schema version 6 (
http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/application_6.xsd)
has entries for <ejb-local-ref>, and that would be the only thing I could
think of for why such an element would exist in this schema, but I can't
seem to piece together if this is indeed what that element is intended for.
 Will these elements indeed take precedence over any other <ejb-local-ref>
elements found anywhere else in any other module in the .ear file?

Thanks for any help,
Best,
Laird

-- 
http://about.me/lairdnelson