title: CDI Producer and Injection
body: <p>i want to use a producer in my application but i'm stuck at the point, where i'm trying to inject the bean. im getting the famous WELD-001409 error. please lighten up my understanding of cdi producer.</p>
  
  <p>here's my interface:</p>
  
  <pre><code>@Named
      public interface MessageSender {
        void sendMessage();
      }
  </code></pre>
  
  <p>the bean:</p>
  
  <pre><code>public class EmailMessageSender implements MessageSender {
  
    @Override
    public void sendMessage() {
      System.out.println("Sending email message");
    }
  
  }
  </code></pre>
  
  <p>and the producer:</p>
  
  <pre><code>@SessionScoped
  public class MessageSenderFactory implements Serializable {
  
      private static final long serialVersionUID = 5269302440619391616L;
  
      @Produces
      public MessageSender getMessageSender() {
          return new EmailMessageSender();
      }
  
  }
  </code></pre>
  
  <p>now i'm injecting the bean:</p>
  
  <pre><code>@Inject 
  MessageSender messageSender;
  </code></pre>
  
  <p>when i'm trying to deploy the project i get the WELD-001409 error and eclipse also is saying that there are multiple injection points.</p>
  
  <p>it works with explicit naming:</p>
  
  <pre><code>@Inject @Named("messageSender")
  MessageSender messageSender;
  </code></pre>
  
  <p>is this naming neccessary?</p>