title: Two beans with same name in different contexts
body: <p>I have the following beans in my contexs:</p>
  
  <pre><code>    &lt;!-- Context 1 --&gt;
  &lt;beans profile="ldap"&gt;
          &lt;bean id="activeDirectoryAuthProvider" class="com.production.ActiveDirectoryLdapAuthenticationProvider"&gt;
            &lt;constructor-arg value="${ldap.login.provider.domain}"/&gt;
            &lt;constructor-arg value="${ldap.login.provider.url}" /&gt;
            &lt;property name="useAuthenticationRequestCredentials" value="true" /&gt;
            &lt;property name="convertSubErrorCodesToExceptions" value="true" /&gt;
          &lt;/bean&gt;
  &lt;/beans&gt;
  
  &lt;!-- Context 2 --&gt;
  
      &lt;bean id="activeDirectoryAuthProvider" class="com.test.TestActiveDirectoryLdapAuthenticationProvider"&gt;
        &lt;constructor-arg value="${ldap.login.provider.domain}"/&gt;
        &lt;constructor-arg value="${ldap.login.provider.url}" /&gt;
        &lt;property name="useAuthenticationRequestCredentials" value="true" /&gt;
        &lt;property name="convertSubErrorCodesToExceptions" value="true" /&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>My goal is to use the first bean only for production version another one for test purposes.</p>
  
  <p>Namely when I start test <strong>based on production</strong> context I expect that production bean would be replaced by test bean with needed configuration.</p>
  
  <p>But unfortunately when I tried to create two beans with  same name only production bean is created and another one is ignored. Another thing that I noticed that when I tried to change test bean name to: <strong>activeDirectoryAuthProvider1</strong> then both beans are successfully created. Can anyone explain why it happen and suggest possible solution how it can be bypassed?</p>