2 Replies Latest reply on Aug 3, 2012 3:09 AM by lucasvc

    Alternative and Producer field

    lucasvc

      Hello,

       

      As I've readed a few times spec and docs about Weld, I saw how to enable a full bean and a producer method Alternative (or in fact specializations).

      But, what about a producer field?

      The case is, a class which delcares a producer field like this:

       

      @SessionScoped
      public class UserLocaleProducer implements Serializable {
           ...
      
           @Produces
           @Client
           @Named
           private Locale userLocale;
      
           ...
      
      }
      

       

      But this <code>userLocale</code> is set wrong. I want to use my own producer method / field.

      With weld-1.1.3.Final, I used to have an alternative (declared in <code>beans.xml</code>) class like this:

       

       

      @Alternative
      public class ClientLocaleProducer {
      
           @Produces
           @Client
           public Locale getConfiguredLocale() {
                ...
           }
      
      }
      

       

      Which worked as I expected. But after upgrading to weld-1.1.8.Final, the webapp deployment tells that there is an ambiguous dependencies.

      In fact, I want to specialize the original bean, but no way of "overriding" the producer method.

      Any way?

       

      Thanks!