7 Replies Latest reply on Jul 27, 2010 7:46 AM by Pete Muir

    How to get Produces bean instance in weld-1.0.2-snapshot

    he youlin Novice
      
      I want to get Produces bean instance in weld-1.0.2-snapshot
      
      Set<Bean<?>> beans = manager.getBeans("mybean");
      Bean<?> sourceBean = beans.iterator().next();
      manager.getReference(sourceBean, sourceBean.getBeanClass(), manager.createCreationalContext(sourceBean));
      
      
      this will throw:
      
       WELD-001305 The given type class com.yofc.jcdi.produces.ProducesUtil is not a type of the bean org.jboss.weld.bean-flat-ProducerMethod-com.yofc.jcdi.produces.ProducesUtil.method getUserInfo()
      
      about code can run in weld 1.0.1
      
      So i change to 
      
      manager.getReference(sourceBean, ((AbstractBean<?, ?>)sourceBean).getType(), manager.createCreationalContext(sourceBean));
      
      But this is not portable