`

Bean named 'sqlMapClient' must be of type [org.springframework.orm.ibatis.SqlMap

    博客分类:
  • OPEN
阅读更多
在整合spring2.5和ibatis2,出现了ibatis的jar包问题。
Bean named 'sqlMapClient' must be of type [org.springframework.orm.ibatis.SqlMapClientTemplate], but was actually of type [com.ibatis.sqlmap.engine.impl.SqlMapClientImpl]


可是在配置文件中明明指定SqlMapClientFactoryBean
      <bean id="sqlMapClient"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation">
<value>
classpath:com/shangwang/persistance/sqlmap/SqlMapConfig.xml
</value>
</property>
<property name="dataSource" ref="dataSource" />

</bean>

怎么程序还依然调用ibatis的SqlMapClientImpl!

呵呵,原来DAO这块,我使用spring2.5byType注入,改成byName。
在spring配置文件中加入:
default-autowire="byName" default-lazy-init="false">  
即可。
配置了这个属性项后,spring会对bean的属性自动按name去寻找,

如果找到则set进去,而不必对Bean的属性进行显式的Set。

分享到:
评论

相关推荐

    Spring高版本对ibatis的支持

    &lt;bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"&gt; &lt;value&gt;classpath:SqlMapConfig.xml &lt;/bean&gt; &lt;bean id="dao" class="org.springframework.orm.ibatis....

    springmvc-ibatis

    &lt;bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"&gt; &lt;value&gt;classpath:ibatis-Base.xml &lt;ref bean="dataSource"/&gt; &lt;/bean&gt; &lt;!-- 配置sqlMapClientTemplate...

    SSI框架整合实例

    &lt;bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"&gt; &lt;value&gt;classpath:SqlMapConfig.xml &lt;/bean&gt; &lt;bean id="personService" class=...

    spring applicationContext 配置文件

    &lt;bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean" p:dataSource-ref="dataSourceProxy"&gt; &lt;value&gt;classpath:SqlMapConfig.xml&lt;/value&gt; &lt;/property&gt; &lt;/bean...

    iBatis-设置缓存模式-Java源码(下载)

    PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"&gt; &lt;sqlMap namespace="Account"&gt; &lt;typeAlias alias="Account" type="Account"/&gt; ...

    ibatis源码 例子

    ibatis 源码 例子 包含 源码,jar都有 部分代码 package com.icss.dao; import java.io.IOException; import java.io.Reader; import java.sql.SQLException; import java.util.List; import ...

    传智播客ibatis视频教程源代码

    private static SqlMapClient sqlMapClient = null;... sqlMapClient.insert("insertStudent",student); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } }

    ibatis框架所需的jar包

    对于初学ibatis者来说,百度上都只提到用ibatis-2.3.0.677.jar,然后在读取配置文件的时候引用不到Resources和SqlMapClient,那么就是少了一个ibatis-sqlmap-2.3.4.726.jar,我把这两个jar同时上传了,希望可以帮助...

    ibatis2.x 详细介绍

    ibatis 开发指南 ibatis Quick Start............................................................................................ 5 准备工作.................................................................

    Spring-Reference_zh_CN(Spring中文参考手册)

    12. 使用ORM工具进行数据访问 12.1. 简介 12.2. Hibernate 12.2.1. 资源管理 12.2.2. 在Spring的application context中创建 SessionFactory 12.2.3. HibernateTemplate 12.2.4. 不使用回调的基于Spring的DAO实现 ...

    ibatis 开发指南(pdf)

    ibatis 开发指南 ibatis Quick Start............................................................................................ 5 准备工作...........................................................

    Spring API

    8.3.7. Spring TestContext Framework 8.3.8. PetClinic示例 8.4. 更多资源 II. 中间层数据访问 9. 事务管理 9.1. 简介 9.2. 动机 9.3. 关键抽象 9.4. 使用资源同步的事务 9.4.1. 高层次方案 9.4.2. 低...

    Spring中文帮助文档

    8.3.7. Spring TestContext Framework 8.3.8. PetClinic示例 8.4. 更多资源 II. 中间层数据访问 9. 事务管理 9.1. 简介 9.2. 动机 9.3. 关键抽象 9.4. 使用资源同步的事务 9.4.1. 高层次方案 9.4.2. 低...

    ibatis开发指南中文版

    ibatis Quick Start............................................................................................5 准备工作...................................................................................

    ibatis开发指南_夏昕

    ibatis Quick Start............................................................................................5 准备工作...................................................................................

    iBATIS 帮助文档

    &lt;typeAlias&gt;元素.....................................................................................................................13 元素................................................................

    ibatis入门教程

    ibatis 开发指南 ibatis Quick Start............................................................................................ 5 准备工作.................................................................

    IBATIS实用记录

    2.1.4 sqlMap节点 6 3. IBATIS基础语义 6 3.1 XMLSQLMAPCLIENTBUILDER 6 3.2 SQLMAPCLIENT 6 3.3 SQLMAPCLIENT基本操作示例 6 3.3.1 数据写入操作(insert, update, delete) 6 3.3.2 数据查询 (select) 7 3.3.3 在...

    iBatis SQL Maps开发指南.pdf

    开发指南 iBATIS SQL Maps Page 3 of 62 Map类型的Result 复杂类型属性(即自定义类型的属性) 避免N+1 Select(1:1) 延迟加载 VS 联合查询(1:1) 复杂类型集合的属性 避免N+1 Select(1:M和M:N) 组合键值或多...

    ibatis例子=》包含了常用方法介绍

    包含SqlMapClient里全部方法的介绍,附带了数据库,绝对的原创,本资源绝对的免费 /* * 带参数的queryForMap用法 */ @SuppressWarnings("unchecked") public Map queryForMap(String sql_name, Object ...

Global site tag (gtag.js) - Google Analytics