How to autowire by name in Spring with annotations? : <p>I have several beans of the same class defined:</p>

<pre><code>  @Bean
  public FieldDescriptor fullSpotField() {
     FieldDescriptor ans = new FieldDescriptor("full_spot", String.class);
     return ans;
  }

  @Bean
  public FieldDescriptor annotationIdField() {
     FieldDescriptor ans = new FieldDescriptor("annotationID", Integer.class);
     return ans;
  }
</code></pre>

<p>consequently when I autowire them</p>

<pre><code>   @Autowired
   public FieldDescriptor fullSpotField;

   @Autowired
   public FieldDescriptor annotationIdField;
</code></pre>

<p>I get an exception</p>

<pre><code>NoUniqueBeanDefinitionException: No qualifying bean of type [...FieldDescriptor] is defined: expected single matching bean but found ...
</code></pre>

<p>How to autowire by name as it possible in XML config?</p>
