You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2013/02/20 01:10:35 UTC
svn commit: r1447976 - in
/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi:
WebAppInjectionResolver.java WebappBeanManager.java
Author: rmannibucau
Date: Wed Feb 20 00:10:35 2013
New Revision: 1447976
URL: http://svn.apache.org/r1447976
Log:
avoid to make cdi deployment fail because of too early usage of ear parents beans
Added:
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/WebAppInjectionResolver.java
Modified:
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/WebappBeanManager.java
Added: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/WebAppInjectionResolver.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/WebAppInjectionResolver.java?rev=1447976&view=auto
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/WebAppInjectionResolver.java (added)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/WebAppInjectionResolver.java Wed Feb 20 00:10:35 2013
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.cdi;
+
+import org.apache.webbeans.container.InjectionResolver;
+
+import javax.enterprise.inject.spi.Bean;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+public class WebAppInjectionResolver extends InjectionResolver {
+ private WebappWebBeansContext context;
+
+ public WebAppInjectionResolver(final WebappWebBeansContext ctx) {
+ super(ctx);
+ context = ctx;
+ }
+
+ @Override
+ public Set<Bean<?>> implResolveByType(final Type injectionPointType, final Class<?> injectinPointClass, final Annotation... qualifiers) {
+ final Set<Bean<?>> set = super.implResolveByType(injectionPointType, injectinPointClass, qualifiers);
+ if (set.isEmpty()) {
+ return context.getParent().getBeanManagerImpl().getInjectionResolver().implResolveByType(injectionPointType, injectinPointClass, qualifiers);
+ }
+ return set;
+ }
+}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/WebappBeanManager.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/WebappBeanManager.java?rev=1447976&r1=1447975&r2=1447976&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/WebappBeanManager.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/WebappBeanManager.java Wed Feb 20 00:10:35 2013
@@ -16,6 +16,7 @@
*/
package org.apache.openejb.cdi;
+import org.apache.openejb.util.reflection.Reflections;
import org.apache.webbeans.component.BeanManagerBean;
import org.apache.webbeans.component.BuildInOwbBean;
import org.apache.webbeans.component.ConversationBean;
@@ -61,6 +62,7 @@ public class WebappBeanManager extends B
super(ctx);
webappCtx = ctx;
deploymentBeans = super.getBeans(); // use the parent one while starting
+ Reflections.set(this, "injectionResolver", new WebAppInjectionResolver(ctx));
}
@Override