myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [myfaces] branch master updated: refactored, getScope doesn't work for @Dependent
Date Tue, 20 Aug 2019 22:03:05 GMT
This is an automated email from the ASF dual-hosted git repository.

tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/master by this push:
     new 519348f  refactored, getScope doesn't work for @Dependent
519348f is described below

commit 519348f5f129cbf0437ce8fd24d863b1f257ae9d
Author: Thomas Andraschko <tandraschko@apache.org>
AuthorDate: Wed Aug 21 00:02:57 2019 +0200

    refactored, getScope doesn't work for @Dependent
---
 impl/src/main/java/org/apache/myfaces/cdi/util/CDIUtils.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/cdi/util/CDIUtils.java b/impl/src/main/java/org/apache/myfaces/cdi/util/CDIUtils.java
index deb21de..e22387b 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/util/CDIUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/util/CDIUtils.java
@@ -91,7 +91,7 @@ public class CDIUtils
         try
         {
             Bean<T> bean = get(beanManager, beanClass, qualifiers);
-            return (bean != null) ? get(beanManager, bean, create) : null;
+            return (bean != null) ? get(beanManager, bean, beanClass, create) : null;
         }
         catch (ContextNotActiveException e)
         {
@@ -99,16 +99,16 @@ public class CDIUtils
         }
     }
 
-    public static <T> T get(BeanManager beanManager, Bean<T> bean, boolean create)
+    public static <T> T get(BeanManager beanManager, Bean<T> bean, Type type,
boolean create)
     {
-        Context context = beanManager.getContext(bean.getScope());
-
         if (create)
         {
-            return context.get(bean, beanManager.createCreationalContext(bean));
+            CreationalContext<?> creationalContext = beanManager.createCreationalContext(bean);
+            return (T) beanManager.getReference(bean, type, creationalContext);
         }
         else
         {
+            Context context = beanManager.getContext(bean.getScope());
             return context.get(bean);
         }
     }


Mime
View raw message