2 Replies Latest reply on Jan 3, 2013 8:16 AM by Alberto Souza

    Generic producer broken with Weld 2

    Alberto Souza Newbie

      I have a producer that produces List for injection. It is a workaround to keep compatibility with Spring, the DI provider that was used. To keep in touch with the weld2, i updated my jboss version and the factory stoped to work. Any ideas? Here is my code:

       

      [java]

      @Produces

                public List producesList(InjectionPoint injectionPoint){

                          ParameterizedType type = (ParameterizedType) injectionPoint.getType();

                    Class klass = (Class) type.getActualTypeArguments()[0];

                    Set<Bean<?>> beans = beanManager.getBeans(klass);

                    ArrayList objects = new ArrayList();

                    for (Bean<?> bean : beans) {

                                         objects.add(beanManagerUtil.instanceFor(bean));

                               }

                          return objects;

                }

      [/java]