Property 'mapperLocations' was not specified
时间: 2023-09-28 09:06:23 浏览: 90
MyBatis异常-Property 'configLocation' not specified, using default MyBatis Configuration
5星 · 资源好评率100%
回答: 当出现Property 'mapperLocations' was not specified的提示时,可能是因为没有指定mybatis-plus的mapper文件的位置。有几种解决方案可以解决这个问题。其中一种方案是将mapper文件放在resources目录下的mapper文件夹中。这样做无需任何配置,也不会提示Property 'mapperLocations' was not specified。因为mybatis-plus的mapper-locations的默认值就是classpath*:/mapper/**/*.xml。\[1\]另一种方案是将mapper文件放在与UserMapper的包目录下,并在application.yml中添加配置mapper-locations: classpath*:com/jiguangchao/mybatisplus_01_quickstart/mapper/**/*.xml。这样做可以遵循maven项目规定,程序不会报错。但是如果不添加mapper-locations配置就会提示Property 'mapperLocations' was not specified。\[2\]此外,即使出现Property 'mapperLocations' was not specified的提示,可能不会影响项目的运行。这可能是因为mybatis-plus有默认的mapper文件位置配置。\[3\]
#### 引用[.reference_title]
- *1* *2* *3* [springboot项目使用mybatis-plus 时出现 Property ‘mapperLocations‘ was not specified的3个解决方案](https://blog.csdn.net/oqqZhe1234/article/details/131060542)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文