java.lang.IllegalStateException: Cannot convert value of type [com.sun.proxy.$Proxy6 implementing cn.itcast.service.IAdminService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [cn.itcast.service.impl.AdminService] for property 'adminService': no matching editors or conversion strategy found
这里用的是事务,所以有JDK代理(从$Proxy6可以看出),上面这个异常说的是代理类无法转化成被代理类。
解决方法:
在action里要用接口代替具体实现类:
// 调用Service private IAdminService adminService; public void setAdminService(IAdminService adminService) { this.adminService = adminService; } public IAdminService getAdminService() { return adminService; }
这样代理类就也属于这个接口了。