sweat89 2012-10-20 11:57
浏览 205
已采纳

springAOP代理

项目是sprin3+ibatis
问题出现在我用spring对ibatis事物管理,我是用AOP来申明的。
service和dao都是通过实现接口完成的。
但是报如下错误:
[code="java"]org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in ServletContext resource [/WEB-INF/daoContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type '$Proxy4 implementing com.service.IUserService,org.springframework.orm.ibatis.SqlMapClientOperations,org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'org.springframework.orm.ibatis.SqlMapClientTemplate' for property 'sqlMapClientTemplate'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [$Proxy4 implementing com.service.IUserService,org.springframework.orm.ibatis.SqlMapClientOperations,org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.springframework.orm.ibatis.SqlMapClientTemplate] for property 'sqlMapClientTemplate': no matching editors or conversion strategy found[/code]

[code="java"]<!-- IBATIS的DAO的配置注入 -->



[/code]

[code="java"] <!-- 系统业务逻辑层的注入 -->


[/code]

在网上到解决方案, [color=red] [/color]。但是这个是强制aop用cglib来代理的。按理说,我的service和dao都实现了接口,应该是默认jdk动态代理,但为什么会报错呢?

  • 写回答

1条回答 默认 最新

  • jinnianshilongnian 2012-10-20 12:03
    关注

    Cannot convert value of type [
    $Proxy4
    implementing com.service.IUserService,
    org.springframework.orm.ibatis.SqlMapClientOperations,
    org.springframework.beans.factory.InitializingBean,
    org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised]

    to required type [
    org.springframework.orm.ibatis.SqlMapClientTemplate]

    UserDaoImpl怎么实现的(是继承SqlMapClientDaoSupport的吗)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

    报告相同问题?

    悬赏问题

    • ¥15 Tpad api账户 api口令
    • ¥30 ppt进度条制作,vba语言
    • ¥15 stc12c5a60s2单片机测光敏ADC
    • ¥15 生信simpleaffy包下载
    • ¥15 请教一下simulink中S函数相关问题
    • ¥15 在二层网络中,掩码存在包含关系即可通信
    • ¥15 端口转发器解析失败不知道电脑设置了啥
    • ¥15 Latex算法流程图行号自定义
    • ¥15 关于#python#的问题:我在自己的电脑上运行起来总是报错,希望能给我一个详细的教程,(开发工具-github)
    • ¥40 基于51单片机实现球赛计分器功能