Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error: Bean property 'userDAO' is not writable or has an invalid setter method.

 
vikas sharmaa
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am getting below wiring error while trying to integrate Spring 3 with hibernate. I followed this site vaannila



here is my code:

userService defined in dispatcher-servlet.xml:



myUserDAO defined in dispatcher-servlet.xml:



UserServiceImpl class:



UserDAOImpl class:



please let me know, where i am going wrong. thank you.
 
vikas sharmaa
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please some expert respond to my query. or do i need to provide more code. please help.
 
vikas sharmaa
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please, anybody here to help me out. Thank you.
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove the @Autowired annotation from userDAO (you're specifying explicitly the dependency with the property tag...), and add a public setter for userDAO!
 
vikas sharmaa
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Lonard, its now working after removing the Autowired!

But, I have a confusion. I am explicitly specifying the dependency of userService bean also with the property tag. And am able to Autowired userService bean as shown below:



Please guide me, why Autowired annotation is working here. Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic