在springmvc与mybatis整合时,需要对每一个mapper定义对应的一个MapperFactoryBean,可以使用MapperScannerConfigurer自动扫描mapper,然后自动为我们注册对应的MapperFactoryBean对象。 例如:

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="annotationClass" value="org.springframework.stereotype.Repository" />
<property name="basePackage" value="net.smui" />
</bean>

basePackage表示需要扫描的包,annotationClass表示需要扫描该包下有该的注解的类。 分享一个链接 Mybatis3.2.1整合Spring3.1

Spring和mybatis整合 org.mybatis.spring.mapper.MapperScannerConfigurer的更多相关文章

  1. spring mybatis 整合问题Error parsing Mapper XML. Cause: java.lang.NullPointerException

    14:30:40,872 DEBUG SqlSessionFactoryBean:431 - Parsed configuration file: 'class path resource [myba ...

  2. SSM整合(2): spring 与 mybatis 整合

    在进行完spring与springmvc整合之后, 继续 spring与mybatis的整合. 既然是操作数据库, 那必然不能缺少了连接属性 一. db.properties jdbc.driver= ...

  3. spring和mybatis整合遇到org.springframework.beans.factory.BeanDefinitionStoreException

    今天对spring和mybatis整合进行练习,通过MapperScannerConfigurer进行mapper扫描 但是在进行单元测试的时候,死活就是报错,具体报错如下: org.springfr ...

  4. 三 SprigMvc与Mybatis整合&实现商品列表功能

    思路: Dao层: 1 逆向工程生成mapper及其配置文件以及pojo 2 SqlMapConfig.xml,空文件即可,需要文件头 3 applicationContext-dao.xml a 数 ...

  5. SpringBoot系列(五)Mybatis整合完整详细版

    SpringBoot系列(五)Mybatis整合 目录 mybatis简介 项目创建 entity dao service serviceImpl mapper controller 1. Mybat ...

  6. java-mybaits-00602-查询缓存-mybatis整合ehcache

    ehcache是一个分布式缓存框架.EhCache 是一个纯Java的进程内缓存框架,是一种广泛使用的开源Java分布式缓存,具有快速.精干等特点,是Hibernate中默认的CacheProvide ...

  7. spring与struts2整合出现错误HTTP Status 500 - Unable to instantiate Action

    在进行spring和struts2整合的时候因为大意遇到了一个问题,费了半天神终于找到了问题所在,故分享出来望广大博友引以为戒!! 我们都知道在spring和struts2整合时,spring接管了a ...

  8. 解决spring mybatis 整合后mapper接口注入失败

    spring整合mybatis,在dao层我们只写一个接口,配置相应的*mapper.xml文件, 报如下错误: org.springframework.beans.factory.Unsatisfi ...

  9. Mybatis(五)Spring整合Mybatis之mapper动态代理开发

    要操作的数据库: IDEA创建的Java工程,目录结构如下: 一.导包 1.spring的jar包 2.Mybatis的jar包 3.Spring+mybatis的整合包. 4.Mysql的数据库驱动 ...

随机推荐

  1. HTML5自定义select标签样式的方法

    HTML5自定义select标签样式的方法 -webkit-appearance: none; 这个东西可以隐藏箭头 不过手机端就直接 设置透明度为0就行了(如果这种做法比前面个要麻烦点 毕竟还要对他 ...

  2. jmeter Dashboard Report

    说明:详情参考:https://jmeter.apache.org/usermanual/generating-dashboard.html JMeter3.0以后引入了Dashboard Repor ...

  3. Java学习笔记二——正则表达式

    Java正则表达式 正则表达式的规则 “abc” 匹配字符串abc [abc] 匹配[]里任意一个字符 [a-z]: 匹配所有小写字母中的任意一个字符 [A-Z]: 匹配所有大写字母中的任意一个字符 ...

  4. 图像变化之Laplacian()函数 and Schaar()滤波及综合例子

    先来  Laplacian()函数 #include<math.h> #include<opencv2/opencv.hpp> #include<string.h> ...

  5. 文件和异常的练习3——python编程从入门到实践

    10-10 常见单词:访问项目Gutenberg(http://gutenberg.org/),并找一些你想分析的图书.下载这些作品的文本文件或将浏览器中的原始文本复制到文本文件中. 可以使用coun ...

  6. VM配置Centos(第十三步分区设置)

    1.点击开启此虚拟机之后,选择第一个 (注意:如果鼠标不显示出来,按alt+ctrl键) 2.然后选择skip跳过检测,如果选择了ok就会有很长时间的检测 3.然后选择NEXT 4.选择中文,然后点击 ...

  7. PostgreSQL学习笔记(二)—— 概览

    数据库 创建数据库: createdb dbname 指定用户名创建数据库: createdb -U username dbname 删除数据库: dropdb dbname 访问数据库: psql ...

  8. SpringCloud整合sleuth,使用zipkin时不显示服务

    转载于:https://www.cnblogs.com/Dandwj/p/11179141.html 原文地址:https://blog.csdn.net/weixin_30416497/articl ...

  9. 未能加载文件或程序集 Microsoft.ReportViewer.ProcessingObjectModel, Version=10.0.0.0

    写在前面 整理错误集.某一天在启动项目的时候,出现了未能加载文件或程序集 Microsoft.ReportViewer.ProcessingObjectModel, Version=10.0.0.0错 ...

  10. Java实现树的遍历以及打印(递归,非递归)

    import java.util.LinkedList; import java.util.Stack; public class BinarySearchTree1<E extends Com ...