[jboss-cvs] JBossAS SVN: r100656 - trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Feb 6 19:55:55 EST 2010


Author: marius.bogoevici
Date: 2010-02-06 19:55:55 -0500 (Sat, 06 Feb 2010)
New Revision: 100656

Modified:
   trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
Log:
JBAS-7704 - CDI injection in EAR-embedded web artifacts

The lookup for the WBInjector is now looking for an injector defined for the current DU and if missing, for one that can be found in any of its parents.

Modified: trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
===================================================================
--- trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java	2010-02-06 14:46:01 UTC (rev 100655)
+++ trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java	2010-02-07 00:55:55 UTC (rev 100656)
@@ -192,7 +192,14 @@
       TomcatInjectionContainer injectionContainer = new TomcatInjectionContainer(webApp, depUnit, context, getPersistenceUnitDependencyResolver());
 
       if (kernel != null) {
-         ControllerContext injectorControllerContext = kernel.getController().getInstalledContext(unit.getName() + "_WBInjector");
+         // Look for a WBInjector bean defined for the current deployment unit. If not found, check the parent.
+         DeploymentUnit inspectedUnit = unit;
+         ControllerContext injectorControllerContext = null;
+         while (inspectedUnit != null && injectorControllerContext == null)
+         {
+            injectorControllerContext = kernel.getController().getInstalledContext(inspectedUnit.getName() + "_WBInjector");
+            inspectedUnit = inspectedUnit.getParent();
+         }
          if (injectorControllerContext != null) {
             injectionContainer.setDefaultInjectors(Collections.singletonList((Injector)injectorControllerContext.getTarget()));
          }




More information about the jboss-cvs-commits mailing list