• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

could not able to set the property from the springapp-servlet.xml throws Failed to convert property

 
gopal krishnan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am trying to set the value from the springapp-servlet.xml and it fails to set the property by giving error message

Failed to convert property value of type [java.lang.String] to required type [ProductManager] for property 'productManager'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [ProductManager] for property 'productManager': no matching editors or conversion strategy found

my code
---------

springapp-servlet.xml
---------------------------------





SimpleProductManager
------------------------------

 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



Your ProductManager property in your controller is of type ProductManager yet you are trying to assign the String "productManager" to it. Use ref instead of value here to reference the bean of type ProductManager with an id of "productManager".
 
gopal krishnan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks the ref has worked..

 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
gopal krishnan wrote:Thanks the ref has worked..



Just think of it like this. In the xml config. value sets it to the exact String value. And ref is to reference another bean which is to be used to set.

So value=String value literal
ref=another bean is sent, with that String name.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic