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的吗)

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

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!