15,000 Jobs Available in:
Java, ASP, C#, PHP, SQL, SAP, MySQL and many more.
- Class Quick -
The moose likes Spring and the fly likes Error: Bean property 'userDAO' is not writable or has an invalid setter method. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Application Frameworks » Spring
Reply Bookmark "Error: Bean property Watch "Error: Bean property New topic
Author

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

vikas sharmaa
Ranch Hand

Joined: Jun 28, 2007
Posts: 179
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

Joined: Jun 28, 2007
Posts: 179
please some expert respond to my query. or do i need to provide more code. please help.
vikas sharmaa
Ranch Hand

Joined: Jun 28, 2007
Posts: 179
please, anybody here to help me out. Thank you.
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
Remove the @Autowired annotation from userDAO (you're specifying explicitly the dependency with the property tag...), and add a public setter for userDAO!


OCJP 6 (93%)
vikas sharmaa
Ranch Hand

Joined: Jun 28, 2007
Posts: 179
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.
 
 
subject: Error: Bean property 'userDAO' is not writable or has an invalid setter method.
 
MyEclipse, The Clear Choice