spring和hibernate的配置报这种错误怎么解决,求大师救-救

问题描述

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testDao' defined in class path resource [dao-beans.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy4] to required type [com.zl.dao.impl.BaseDaoImpl] for property 'baseDao'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy4] to required type [com.zl.dao.impl.BaseDaoImpl] for property 'baseDao': no matching editors or conversion strategy foundat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)at java.security.AccessController.doPrivileged(Native Method)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)at com.zl.test.SpringTest.runTest(SpringTest.java:20)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy4] to required type [com.zl.dao.impl.BaseDaoImpl] for property 'baseDao'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy4] to required type [com.zl.dao.impl.BaseDaoImpl] for property 'baseDao': no matching editors or conversion strategy foundat org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1287)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1248)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1008)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)... 34 moreCaused by: java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy4] to required type [com.zl.dao.impl.BaseDaoImpl] for property 'baseDao': no matching editors or conversion strategy foundat org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:219)at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)... 38 more 问题补充:morgan117 写道

解决方案

最好还有com.zl.dao.impl.TestBeanDaoImpl这个类的代码,只要把属性贴出来就行
解决方案二:
你有设置自动代理baseDao这个类吗?又没有用到BeanNameAutoProxyCreator或者DefaultAdvisorAutoProxyCreator类呢?
解决方案三:
你把实例化这个bean的代码贴出来看
解决方案四:
baseDao这个属性,你传进去的是baseDao的代理类,自然不能转化为BaseDao类的。

时间: 2024-09-13 07:12:56

spring和hibernate的配置报这种错误怎么解决,求大师救-救的相关文章

hibernate delete语句报QueryParameterException错误

问题描述 hibernate delete语句报QueryParameterException错误 代码: @Override public void delete(int id) { // TODO Auto-generated method stub Session session = getSession(); String hql = "delete from Services where id = ?"; Query q = session.createQuery(hql);

spring和hibernate整合出错,请大神帮忙解决,谢谢

问题描述 spring和hibernate整合出错,请大神帮忙解决,谢谢 <!-- Hibernate和spring整合的配置 配置SessionFactory --> <!-- 指定hibernate的配置文件位置 --> <!-- 配置c3p0数据库连接池 --> <!--通过反射设置set方法--> <!-- 数据连接信息 --> <!-- 其他配置 --> <!-- 初始化时获取三个连接,取值应在minPoolSize与

数据库 oracle linux-ORACLELINUX下安装oracle11gxe后连接数据库报ora-12705错误如何解决

问题描述 ORACLELINUX下安装oracle11gxe后连接数据库报ora-12705错误如何解决 实验操作环境: 操作系统:OracleLinux-R7-U0-Server-x86_64 数据库版本:oracle-xe-11.2.0-1.0.x86_64 在上述环境中安装完数据库以后连接登录数据库,操作如下图所示: 报了ora-12705的错误信息 根据网上提供的信息实践了很多方法,修改设置了字符集配置,问题依旧 目前本机的字符集如下图所示: 不知道我是否还忽略了什么关键要素,请高人指教

mysql数据库报如下错误,跪求解决

问题描述 mysql数据库报如下错误,跪求解决 --- The error happened while setting a property on the result object. --- Cause: com.ibatis.common.beans.ProbeException: Could not get property 'dynamicFields' from com.aspire.ess.domain.Accounts. Cause: java.lang.ClassCastExc

关于SSIS批量抽取Excel文件报0x80004005错误的解决办法

原文:关于SSIS批量抽取Excel文件报0x80004005错误的解决办法 标题: Microsoft Visual Studio ------------------------------ Package [连接管理器"Excel 连接管理器"] 出错: SSIS 错误代码 DTS_E_OLEDBERROR.出现 OLE DB 错误.错误代码: 0x80004005. 已获得 OLE DB 记录.源:"Microsoft JET Database Engine"

lua-运行程序报这个错误怎么解决噢

问题描述 运行程序报这个错误怎么解决噢 [LUA-print] Debugger v1.1.0 [LUA-print] Debugger: Trying to connect to 127.0.0.1:10000 ... [LUA-print] Debugger: Connection succeed. debug args = require('debugger')('127.0.0.1','10000','luaidekey',nil,'win','/TestRun/','C:/Users/

spring mvc-SPRING MVC的注解报404错误!

问题描述 SPRING MVC的注解报404错误! @Controller @RequestMapping("/user") @SessionAttributes("username") public class UserAction { @RequestMapping(params="method=reg") public String reg(@ModelAttribute("username")String userna

spring mvc-springmvc 和velocity 配置 报错 VelocityEngineFactory NoClassDefFoundError

问题描述 springmvc 和velocity 配置 报错 VelocityEngineFactory NoClassDefFoundError spring 4.1.6.RELEASE maven方式. 报错如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountController': Injection of autowired dependenc

6G数据库的导入 报各种错误的解决办法_Mysql

工具选择 一.sqlyog 这个工具还是很强大的,但是面对5个G的数据库来说,也只能罢工了,简单说,本机导入可以,从本机导入服务器不行. 二.phpadmin 自带的这个挺人家说还行,但是最后没用过,原因是看不见,因为最多50M,虽然修改配置文件可以上传但是5个G还是算了吧,没那个信心. 三.还有一个是一个PHP脚本.好像是德国人写的.这个东西,也是导入数据的,怎嘛说呢,本人是没试验成功.但是网上叫好一片,我是5G数据没点成功,这是折腾了第二天了. 四.数据库分割导入这个我也用到了,每个分割10