aspose file tools*
The moose likes Other Application Frameworks and the fly likes problens in spring CustomDataEditor! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "problens in spring CustomDataEditor!" Watch "problens in spring CustomDataEditor!" New topic
Author

problens in spring CustomDataEditor!

Carlos Eduardo Z. Batist�o
Greenhorn

Joined: Apr 27, 2006
Posts: 2
hi people... everybody is ok!? =)

well my doubt about CustomDataEditor is...
in my XML code for spring...



but when i run my test class...
is print this strack exception...

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'greetingService' defined in file [C:\leco\eclipse\workspace\Spring\hello.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [java.util.Date] for property 'date2']
PropertyAccessExceptionsException (1 errors)
org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [java.util.Date] for property 'date2'
at org.springframework.beans.BeanWrapperImpl.doTypeConversionIfNecessary(BeanWrapperImpl.java:951)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:692)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:572)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:737)
at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:764)
at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:753)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1061)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:857)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:37
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
at com.springinaction.chapter01.hello.HelloApp.main(HelloApp.java:19)


what's wrong i make!? everybody make me help this...

thanks! =)
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Strange, it works for me...
Did you try to declare customEditorConfigurer before the greetingService bean ?


[My Blog]
All roads lead to JavaRanch
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

I think I got your problem. I'm using an ApplicationContext to get my beans.
As described here using ApplicationContext is the preferred method to use CustomEditorConfigurer.

If you want to use a BeanFactory, you'll have to register the custom editor.
For example :


With an ApplicationContext, it's easier, there's nothing to do !!
Carlos Eduardo Z. Batist�o
Greenhorn

Joined: Apr 27, 2006
Posts: 2
thanks guys
the problem is... because i'm using BeanFactory!!

when i change for using ApplicationContext it's work!!!


thanks for help!!

see ya!
 
 
subject: problens in spring CustomDataEditor!