方式一:(推荐)
<mappers>
<mapper resource="com/offcn/mapper/UserMapper.xml"/>
</mappers>
方式二:
<!--每一个Mapper.xml文件都需要在mybatis核心配置文件中注册-->
<mappers>
<mapper class="com.offcn.dao.UserMapper"/>
</mappers>
注意:
- 接口和它的Mapper配置文件必须同名!
- 接口和它的Mapper配置文件必须在同一个包下!
方式三:
<!--每一个Mapper.xml文件都需要在mybatis核心配置文件中注册-->
<mappers>
<package name="com.offcn.dao"/>
</mappers>
注意:
- 接口和它的Mapper配置文件必须同名!
- 接口和它的Mapper配置文件必须在同一个包下!