title: Spring behaviour when using interface name also as a bean name?
body: <p>I found the following unorthodox configuration in my code base the other day and it made me wonder. What is the expected Spring Context behavior when I use an interface name also as the name of a bean? Would it make a difference if I was using @Autowiring in my Controller? The following snippet illustrates this setup:</p>
  
  <pre><code>interface MyAppService {...}
  
  class InfrastructureService implements MyAppService {...}
  
  class AdministrationService implements MyAppService {...}
  
  class InfrastructureController {
     // some code
     public void setMyAppService(MyAppService svc){...}
  }
  
  &lt;bean id="myAppService" class="InfrastructureService"/&gt;
  
  &lt;bean id="administrationService" class="AdministrationService"/&gt;
  
  &lt;bean id="infrastructureController" class="InfrastructureController"&gt;
     &lt;property name="myAppService" ref="myAppService"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Alternatively, what would be the expected behaviour if only the controller was defined as:</p>
  
  <pre><code>class InfrastructureController {
     @Autowired
     public void setMyAppService(MyAppService svc){...}
  }
  </code></pre>