No MyBatis mapper was found in '[com.taiji]' package. Please check your configuration.
时间: 2023-10-21 16:54:15 浏览: 216
回答: 这个问题的原因是在指定的包路径下没有找到MyBatis的Mapper接口。根据引用\[1\]中的报错日志,可以看到警告信息" No MyBatis mapper was found in '\[com.taiji\]' package. Please check your configuration."。解决这个问题的方法是在项目内的某个路径下建立一个接口,并在接口上添加@Mapper注解。需要注意的是,这个接口不能在@MapperScan注解定义的basePackage路径下,否则会出现另外一个新的警告"Skipping MapperFactoryBean with name xx Bean already defined with the same name!"。这是因为在启动时,Spring Boot的默认basePackage会被MyBatis-Plus的自动配置拿来作为基目录去扫描是否有带有@Mapper注解的接口需要注册到Spring容器中。如果没有这个注解,则会报错。同时,如果@Mapper注解定义的接口在@MapperScan注解定义的路径下,会导致重复扫描创建bean的问题。因此,需要确保这两个注解不在同一个路径下。\[1\]\[3\]
#### 引用[.reference_title]
- *1* [MyBatis(或Plus):找不到xml文件。No MyBatis mapper was found in ‘[com.**.**.mapper]‘ package](https://blog.csdn.net/qq_16946803/article/details/121470227)[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^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [No MyBatis mapper was found in ‘[xxx.mapper]‘ package. Please check your configuration.](https://blog.csdn.net/GaoL77/article/details/129168248)[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^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [No MyBatis mapper was found in ‘[xx.mapper]‘ package. Please check your configuration.特殊处理](https://blog.csdn.net/h15915793385/article/details/122893729)[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^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文