其他配置
通用mapper
映射器(mappers)
MapperRegistry:注册绑定我们的mapper文件;
方式一:(推荐使用)
<!--每一个Mapper.xml都需要在Mybatis核心配置文件中注册!-->
<mappers>
<mapper resource="com/bubbles/dao/UserMapper.xml"/>
</mappers>
方式二:使用class文件绑定注册
<!--每一个Mapper.xml都需要在Mybatis核心配置文件中注册!-->
<mappers>
<mapper class="com.bubbles.dao.UserMapper"/>
</mappers>
注意点:
接口和他的Mapper配置文件必须同名
接口和他的Mappe配置文件必须在同一个包下!
方式三:使用扫描包进行注入绑定
<!--每一个Mapper.xml都需要在Mybatis核心配置文件中注册!-->
<mappers>
<mapper class="com.bubbles.dao"/>
</mappers>
注意点:
接口和他的Mapper配置文件必须同名
接口和他的Mappe配置文件必须在同一个包下!