MyBatis 核心配置文件配置mapper

MyBatis 核心配置文件配置mapper

MyBatis 核心配置文件配置mapper标签内容时有一点需要注意:

如果 resource 在 resources 文件夹下,则直接填写文件名,就像这样:

<mappers>
    <mapper resource="BlogMapper.xml"/>
</mappers>

如果 resource 在类路径下,则需要填写包路径名,像这样:

<mappers>
    <mapper resource="org/mybatis/example/BlogMapper.xml"/>
</mappers>

参考资料:

[1] meng2113.Could not find resource com/meng/dao/UserMapper.xml.博客园,2020-08-18:https://www.cnblogs.com/Meng2113/p/13523539.html#autoid-0-1-0

posted @ 2021-09-14 21:41  realzhangsan  阅读(94)  评论(0编辑  收藏  举报