title: How does Spring Framework choose between two components?
body: <p>I'm new to Spring and Dependancy Injection, so I'll do my best, but this question may not be perfectly formed.</p>
  <p>In short, imagine a 'sandwich' program that has a 'cheese' component. swiss cheese and provalone cheese both fit the interface, so they can both be used in our sandwich. Our code might look something like this.</p>
  <pre><code>class Sandwich{
     @Autowired
     Meat m;
     @Autowired
     Cheese c;
  }
  
  @Component
  class Ham implements Meat{
  }
  
  @Component
  class Swiss implements Cheese{
  }
  
  @Component
  class Provolone implements Cheese{
  }
  </code></pre>
  <p>It is obvious that spring framework will use ham as the meat; it’s the only meat component. But how does spring framework choose between Swiss and provolone? Is there some further setup required by the programmer? If so, how is this not tight coupling?</p>
  <p>Thanks for the info! This enterprise level coding is new (and slightly intimidating) to me, so any input is appreciated.</p>