Spring 报错怎么回事

qq_28858755 2016-10-25 01:34:11
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'departmentService' defined in file [C:\Users\Ma\Desktop\学习\wp1\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ssh\WEB-INF\classes\applicationContext-beans.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.ssh.service.EmployeeService$$EnhancerByCGLIB$$67a7b9ee' to required type 'com.ssh.dao.DepartmentDao' for property 'departmentDao'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.ssh.service.EmployeeService$$EnhancerByCGLIB$$67a7b9ee] to required type [com.ssh.dao.DepartmentDao] for property 'departmentDao': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:700)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:381)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.ssh.service.EmployeeService$$EnhancerByCGLIB$$67a7b9ee' to required type 'com.ssh.dao.DepartmentDao' for property 'departmentDao'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.ssh.service.EmployeeService$$EnhancerByCGLIB$$67a7b9ee] to required type [com.ssh.dao.DepartmentDao] for property 'departmentDao': no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:473)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:509)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1502)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1461)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1197)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
... 21 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [com.ssh.service.EmployeeService$$EnhancerByCGLIB$$67a7b9ee] to required type [com.ssh.dao.DepartmentDao] for property 'departmentDao': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:267)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:458)
... 27 more
...全文
172 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
LinkRay 2016-10-25
  • 打赏
  • 举报
回复
注入的类型不对
自由自在_Yu 2016-10-25
  • 打赏
  • 举报
回复
顶一下
lmkght 2016-10-25
  • 打赏
  • 举报
回复
Error creating bean with name 'departmentService' defined 错误写的很清楚了,楼上的几位也解释过了
能源恒观 2016-10-25
  • 打赏
  • 举报
回复
应该是departmentService注入的时候配置错了
小灯光环 2016-10-25
  • 打赏
  • 举报
回复
没有匹配的转换策略,你检查一下注入的类型
bcsflilong 2016-10-25
  • 打赏
  • 举报
回复
Failed to convert property value of type 你配置注入的时候 注入的类型不对 你检查一下 是不是departmentDao的注入

81,095

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧