MapperRegistry:注册绑定我们的Mapper文件
方式一:
<!--每一个Mapper.XML都需要在Mybatis核心配置文件中注册!-->
<mappers>
<mapper resource="com/---/dao/userMapper.xml"/>
</mappers>
方式二:使用class文件绑定注册
<!--每一个Mapper.XML都需要在Mybatis核心配置文件中注册!-->
<mappers>
<mapper class="com.---.dao.userMapper"/>
</mappers>
注意点
接口和他的Mapper配置文件必须同名
接口和他的Mapper配置文件必须在同一个包下!
方式三:使用扫描包进行注入绑定
<!--每一个Mapper.XML都需要在Mybatis核心配置文件中注册!-->
<mappers>
<package name = "com.---.dao."/>
</mappers>