title: String to Date Conversion in Spring 4.0
body: <p>I am educating myself on Spring 4.0.0 M3
  Following is the code,</p>
  
  <p><strong>Bean</strong></p>
  
  <pre><code>package org.chebus.springs;
  
  import java.util.Date;
  
  public class Traingle {
      private String name;
      private int height;
      private Date date;
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public int getHeight() {
          return height;
      }
  
      public void setHeight(int height) {
          this.height = height;
      }
  
      public Date getDate() {
          return date;
      }
  
      public void setDate(Date date) {
          this.date = date;
      }
  
      public void drawShape() {
          System.out.println(getName() + " Traingle height " + getHeight()
                  + " Date = " + getDate());
      }
  
  }
  </code></pre>
  
  <p><strong>Main</strong></p>
  
  <pre><code>ApplicationContext ctx = new ClassPathXmlApplicationContext("org/chebus/springs/Spring.xml");
          Traingle traingle = ctx.getBean("traingle",Traingle.class);
          traingle.drawShape();
  </code></pre>
  
  <p><strong>XML Config</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"&gt;
  
  &lt;bean id = "traingle" class="org.chebus.springs.Traingle"&gt;
    &lt;property name="name" value = "RightAngled"/&gt;
    &lt;property name="height" value = "20"/&gt;
    &lt;property name="date" value = "2013-09-10"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="dateEditor"
          class="org.springframework.beans.propertyeditors.CustomDateEditor"&gt;
  
          &lt;constructor-arg&gt;
              &lt;bean class="java.text.SimpleDateFormat"&gt;
                  &lt;constructor-arg value="yyyy-MM-dd" /&gt;
              &lt;/bean&gt;
          &lt;/constructor-arg&gt;
          &lt;constructor-arg value="true" /&gt;
  
      &lt;/bean&gt;
  
      &lt;bean class="org.springframework.beans.factory.config.CustomEditorConfigurer"&gt;
          &lt;property name="customEditors"&gt;
              &lt;map&gt;
                  &lt;entry key="java.util.Date"&gt;
                      &lt;ref local="dateEditor" /&gt;
                  &lt;/entry&gt;
              &lt;/map&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
  
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>Exception:</strong></p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: Cannot convert value of type
    [org.springframework.beans.propertyeditors.CustomDateEditor] to
    required type [java.lang.Class] for property
    'customEditors[java.util.Date]': PropertyEditor
    [org.springframework.beans.propertyeditors.ClassEditor] returned
    inappropriate value of type
    [org.springframework.beans.propertyeditors.CustomDateEditor]  at
    org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:260)
      at
    org.springframework.beans.TypeConverterDelegate.convertToTypedMap(TypeConverterDelegate.java:620)
      at
    org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:205)
      at
    org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:459)
      ... 17 more</p>
  </blockquote>
  
  <p>Not sure where i am going wrong. Appreciate your help. Thanks!</p>