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 while Proxying DAO Classes

 
Vivek Kr Singh
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am pasting this after searching the forum and not finding a suitable answer for this. I am using spring-2.5.6 and implementing AOP in my application.

Below is my Spring Config:


On container init the following error is generated:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employeesService' defined in class path resource [springConfig.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy10 implementing org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.vivek.spring.employee.jdbc.dao.EmployeeDAO] for property 'employeeDAO'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy10 implementing org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.vivek.spring.employee.jdbc.dao.EmployeeDAO] for property 'employeeDAO': no matching editors or conversion strategy found

This error is not generated when i am proxying only the Service classes using "*Service".

Snippet of Service Class


It would be great if spring guru's can point out the mistake in configuration.

Mod's it is a long message i have posted. Please let me know if this need to be split into 2-3 posts.
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You proxy both Dao and Service, and also inject (proxy)Dao to Service so TypeMismatchException happens.
 
Vivek Kr Singh
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the answer. Is there any way AOP can be applied on the DAO classes ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic