File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CustomEditorConfigurer Exception

 
S Dave
Ranch Hand
Posts: 103
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Could you please point out why I get the following exception while trying to use CustomEditorConfigurer? Thanks in advance for your time.

org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [java.util.Date] for property 'dt'; nested exception is java.lang.IllegalArgumentException: No matching editors or conversion strategy found
Caused by: java.lang.IllegalArgumentException: No matching editors or conversion strategy found

My configuration file contains the following:

<bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
<property name="customEditors">
<map>
<entry key="java.util.Date">
<bean class="MyDateEditor"></bean>
</entry>
</map>
</property>
</bean>

My property editor is defined below:

public class MyDateEditor extends PropertyEditorSupport
{
private String dt;
public void setAsText(String text) throws IllegalArgumentException
{
this.dt = text;
Date dtobj= new Date(dt);
setValue(dtobj);
}
}

My Bean class

public class Story
{
private String title;
private String author;
private String content;
private Date dt;
//accessors for other fields go here...
public Date getDt()
{
return dt;
}
public void setDt(Date dt)
{
this.dt = dt;
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic