mappers----映射器(也就是mybatis--config.xml内引用mapper.xml文件)

作用:将mapper.xml 文件配置到mybatis-config.xml的环境中。
<mapper url=”file…xml”这种是在硬盘中读取的,这种几乎不用
mappers----映射器(也就是mybatis--config.xml内引用mapper.xml文件)
使用mapper接口路径
这里所谓的mapper接口路径。实际上就是dao的接口路径。在mybatis中,通常把dao的包叫做mapper!!类名,也叫做mapper

  1. 定义一个接口
  2. 在接口所在的包中定义mapper.xml(也就是将xml文件存放在和mapper接口一个包下)
  3. 在mybatis-config.xml 中通过class路径,引入mapper。要求mapper.xml 中的名称空间是类的接口的全路径

例如:
mappers----映射器(也就是mybatis--config.xml内引用mapper.xml文件)

使用mapper接口扫描包(一次将所有的xml文件导入)

mappers----映射器(也就是mybatis--config.xml内引用mapper.xml文件)
这个扫描的包为:
mappers----映射器(也就是mybatis--config.xml内引用mapper.xml文件)