You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jo...@apache.org on 2017/07/10 01:14:51 UTC

svn commit: r1801402 - in /geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi: ConfigExtension.java ConfigInjectionBean.java

Author: johndament
Date: Mon Jul 10 01:14:50 2017
New Revision: 1801402

URL: http://svn.apache.org/viewvc?rev=1801402&view=rev
Log:
Only define beans for provider as alternatives, otherwise they're not alternatives.

Modified:
    geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java
    geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigInjectionBean.java

Modified: geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java
URL: http://svn.apache.org/viewvc/geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java?rev=1801402&r1=1801401&r2=1801402&view=diff
==============================================================================
--- geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java (original)
+++ geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java Mon Jul 10 01:14:50 2017
@@ -147,7 +147,7 @@ public class ConfigExtension implements
                                 return Stream.empty();
                             }
                             final Class<?> providerType = Class.class.cast(paramType.getActualTypeArguments()[0]);
-                            return Stream.of(new ConfigInjectionBean<Provider<?>>(injection.type) {
+                            return Stream.of(new ConfigInjectionBean<Provider<?>>(injection.type, true) {
                                 @Override
                                 public Provider<?> create(final CreationalContext<Provider<?>> context) {
                                     return () -> config.getValue(keyProvider.apply(context), providerType);
@@ -215,7 +215,7 @@ public class ConfigExtension implements
                         // and not sure it would be done this way anyway
                         final ParameterizedTypeImpl providerType = new ParameterizedTypeImpl(Provider.class, injection.type);
                         if (injections.stream().noneMatch(i -> i.type.equals(providerType))) {
-                            beans.add(new ConfigInjectionBean<Provider<?>>(providerType) {
+                            beans.add(new ConfigInjectionBean<Provider<?>>(providerType, true) {
                                 @Override
                                 public Provider<?> create(final CreationalContext<Provider<?>> context) {
                                     return () -> bean.create(context);

Modified: geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigInjectionBean.java
URL: http://svn.apache.org/viewvc/geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigInjectionBean.java?rev=1801402&r1=1801401&r2=1801402&view=diff
==============================================================================
--- geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigInjectionBean.java (original)
+++ geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigInjectionBean.java Mon Jul 10 01:14:50 2017
@@ -44,12 +44,18 @@ public abstract class ConfigInjectionBea
     private final Class rawType;
     private final Set<Type> types;
     private final String id;
+    private final boolean alternative;
 
     ConfigInjectionBean(Type type) {
+        this(type,false);
+    }
+
+    ConfigInjectionBean(Type type, boolean alternative) {
         this.types = new HashSet<>();
         this.types.add(type);
         this.rawType = getRawType(type);
         this.id = "ConfigInjectionBean_" + type.toString();
+        this.alternative = alternative;
     }
 
     private Class getRawType(Type type) {
@@ -112,7 +118,7 @@ public abstract class ConfigInjectionBea
 
     @Override
     public boolean isAlternative() {
-        return true;
+        return alternative;
     }
 
     @Override