title: How can Spring get generic type information during runtime regarding "Strongly-typed collection"?
body: <p>I read below in Spring 3.0 document:</p>
  
  <p><em>Strongly-typed collection (Java 5+ only)</em></p>
  
  <p><em>In Java 5 and later, you can use strongly typed collections (using generic types). That is, it is possible to declare a Collection type such that it can only contain String elements (for example). If you are using Spring to dependency-inject a strongly-typed Collection into a bean, you can take advantage of Spring's type-conversion support such that the elements of your strongly-typed Collection instances are converted to the appropriate type prior to being added to the Collection.</em></p>
  
  <pre><code>public class Foo {
  
    private Map&lt;String, Float&gt; accounts;
  
    public void setAccounts(Map&lt;String, Float&gt; accounts) {
        this.accounts = accounts;
    }
  }
  
  &lt;beans&gt;
    &lt;bean id="foo" class="x.y.Foo"&gt;
        &lt;property name="accounts"&gt;
            &lt;map&gt;
                &lt;entry key="one" value="9.99"/&gt;
                &lt;entry key="two" value="2.75"/&gt;
                &lt;entry key="six" value="3.99"/&gt;
            &lt;/map&gt;
        &lt;/property&gt;
    &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p><em><strong>When the accounts property of the foo bean is prepared for injection, the generics information about the element type of the strongly-typed Map is available by reflection.</strong> Thus Spring's type conversion infrastructure recognizes the various value elements as being of type Float, and the string values 9.99, 2.75, and 3.99 are converted into an actual Float type.</em></p>
  
  <p>how can this be possible? As I know generic type information is erased during compilation. </p>