微服务 教程
1085个小节阅读:195.5k
目录
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
<mappers>
用于注册映射文件或持久层接口,只有注册的映射文件才能使用,共有四种方式都可以完成注册:
使用相对路径注册映射文件
xxxxxxxxxx
<mappers>
<mapper resource="com/itbaizhan/mapper/UserMapper.xml"/>
</mappers>
使用绝对路径注册映射文件
xxxxxxxxxx
<mappers>
<mapper url="file:///C:\Users\a\IdeaProjects\mybatiscase\mybatisDemo1\src\main\resources\com\itbaizhan\mapper\UserMapper.xml"/>
</mappers>
注册持久层接口
xxxxxxxxxx
<mappers>
<mapper class="com.itbaizhan.mapper.UserMapper"/>
</mappers>
注册一个包下的所有持久层接口
xxxxxxxxxx
<mappers>
<package name="com.itbaizhan.mapper"/>
</mappers>
1. 在MyBatis配置文件中,<mappers>
下使用<package>
表示
A 使用相对路径注册映射文件
B 使用绝对路径注册映射文件
C 注册一个包下的所有持久层接口
D 注册持久层接口
2. 在MyBatis配置文件中,<mapper>
注册持久层接口使用的属性是:
A resource
B url
C name
D class
1=>C 2=>D