Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Type Mismatch - why i am getting this error?

 
Karnati Sudhakar
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My code looks like below:



Here i am using getBean() method with argument classtype. Why i am getting the error :
Type mismatch: cannot convert from Object to Car



Anything i am missing or doing wrong?

Thanks
Sudhakar
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, you're not casting.
 
Karnati Sudhakar
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Yeah, you're not casting.


Thanks David for your reply..

But here i am giving the type of the object as second argument in the getBean method..

Is it not the right way?

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where are you getting this warning ? In an editor ?
 
Karnati Sudhakar
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe Verré wrote:Where are you getting this warning ? In an editor ?


I am getting this warning in eclipse
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which version of Spring are you using ? If you are using a version prior to 3.0, then you'll need to cast. From Spring 3.0, getBean uses generics, so you don't need to cast.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic