title: Why does Spring obviously merges two different beans?
body: <p>I am quite new to Spring and atm checking out XML-driven Spring.</p>
  
  <p>Now my problem is that Spring somehow merges two different bean-objects coming from the same bean-class. It treats them as one single object.</p>
  
  <p>Please, take a look at the following code:</p>
  
  <pre><code>&lt;bean id="shapeList1" class="coreservlets.ShapeListMaker" &gt;
      &lt;constructor-arg index="0"&gt;
          &lt;list&gt;
          &lt;ref local="shape1" /&gt; 
          &lt;/list&gt;
      &lt;/constructor-arg&gt;
  &lt;/bean&gt;
  &lt;bean id="shapeList2" class="coreservlets.ShapeListMaker"  &gt;
      &lt;constructor-arg&gt;
          &lt;ref local="shape2" /&gt;
      &lt;/constructor-arg&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>...the related class:</p>
  
  <pre><code>public class ShapeListMaker {
  
  public ShapeListMaker (List&lt;Shape&gt; shapes) {
      shapelist = shapes;
  }
  
  public ShapeListMaker (Shape shape) {
      shapelist.add(shape);
  }
  
  private static List&lt;Shape&gt; shapelist = new ArrayList&lt;&gt;();
  </code></pre>
  
  <p>Comparing both objects (shapeList1 == shapeList2) returns <strong>true</strong>. Printing out one of the lists produces both shapes, <strong>shape1</strong> and <strong>shape2</strong>... Why? I am confused...</p>
  
  <p>Via the same xml-file I created some other bean objects in the same way (the <strong>shape</strong> beans) without any trouble or merging. </p>