title: Spring Component dependency injection of a field with multiple implementations
body: <p>I have a class MyMessageConsumer which is a spring Component. I have autowired MessageReceiver interface as below :</p>
  
  <pre><code>    @Component
      @Scope("prototype")
      public class MyMessageConsumer {
  
       @Autowired
       private MessageReceiver messageReceiver;
  
      }
  </code></pre>
  
  <p>I want to create multiple bean instances of MyMessageConsumer each with different implementations of MessageReceiver say TextMessageReceiver, XMLMessageReceiver, JSONMessageReceiver.</p>
  
  <pre><code>    // If a setter is provided in MyMessageConsumer, then it would be suffiecent. But how to do it without setter.
  </code></pre>
  
  <p>Is it possible to inject different implementation without a setter method in the above scenario? Otherwise please suggest the best alternative.</p>
  
  <p>Thanks in advance.</p>