This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
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
------------------------------

 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • 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..

 
ranger
Posts: 17346
11
Mac IntelliJ IDE 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
 
Friends help you move. Good friends help you move bodies. This tiny ad will help:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic