在spring+hibernate+struts2项目中的一个 java.lang.IllegalArgumentException

问题描述:

情况是这样的 :loginAction中需要用到两个业务类 UserManager TmsManager
设为私有属性后 提供set get方法 并且都在spring 配置文件中配置好了 但是调用loginAction时出现下列异常:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loginAction' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: [color=darkred]Failed to convert property value of type [$Proxy0] to required type [com.lmz.tms.manager.UserManager] for property 'userManager'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy0] to required type [/color][com.lmz.tms.manager.UserManager] for property 'userManager': no matching editors or conversion strategy found

这是 spring部分配置:












看下你导的包,有没重复,有重复就删掉一个。如果没有就试下这个方法,在loginAction里面把private [color=red]UserManager[/color] userManager;改为由她的接口做为类型,即:
比如IUserManager为UserManager的接口,则userManager的定义为:
private [color=red]IUserManager[/color] userManager