Home  >  Forum  >  Spring
Post New Query

BeanWrapperImpl| no matching editors or conversion strategy found


joined on
August 15,2013
Asked on August 18,2013
java.lang.IllegalStateException: Cannot convert value of type [org.springframework.beans.BeanWrapperImpl] to required type [com.mypack.Employee] for property  manager : no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:485)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:516)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1119)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:904)
at com.concretepage.SpringDemo.main(SpringDemo.java:14)
Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.springframework.beans.BeanWrapperImpl] to required type [com.mypack.Employee] for property  manager : no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:241)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:470)
... 4 more


I am using BeanWrapper and trying to test with two bean but got below error.

Code snippet is 

           BeanWrapper emp = new BeanWrapperImpl(new Employee());
  emp.setPropertyValue("name","somename");
  emp.setPropertyValue("age","24");
  
  BeanWrapper company = new BeanWrapperImpl(new Company());
  company.setPropertyValue("name", "any company");
  company.setPropertyValue("director", emp);
joined on
May 11,2013
Replied on August 18,2013

Rahul, check your line of code
company.setPropertyValue("director", emp);

it  should be like
company.setPropertyValue("director",  emp.getWrappedInstance());

I hope it will help you.


Write Answer








Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us