[org.mybatis.spring.mapper.ClassPathMapperScanner]-No MyBatis mapper was found in '[com.xxx.xxx.dao]

本文解决了一个关于MyBatis在Spring项目中未能找到指定包下DAO接口的问题。问题出现的原因是在配置文件中错误地定义了DAO接口的扫描路径。通过注释或移除错误配置解决了该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

版权声明:本文为 testcs_dn(微wx笑) 原创文章,非商用自由转载-保持署名-注明出处,谢谢。 https://blog.youkuaiyun.com/testcs_dn/article/details/79074633

项目启动后,控制台输出中有以下内容:

[org.mybatis.spring.mapper.ClassPathMapperScanner]-No MyBatis mapper was found in '[com.xxx.xxx.dao]' package. Please check your configuration.


这是因为 spring-mybatis.xml 配置文件中多了以下:

	<!-- DAO接口所在包名,Spring会自动查找其下的类
	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<property name="basePackage" value="com.xxx.xxx.dao" />
		<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>
	</bean>
	 -->
把它注释掉或删除就可以了。

2025-07-07 16:02:14.361 [main] WARN org.mybatis.spring.mapper.ClassPathMapperScanner:44 - Skipping MapperFactoryBean with name 'astDisposeBillBossDao' and 'com.pty.ast.dao.AstDisposeBillBossDao' mapperInterface. Bean already defined with the same name! 2025-07-07 16:02:14.361 [main] WARN org.mybatis.spring.mapper.ClassPathMapperScanner:44 - No MyBatis mapper was found in '[com.pty.ast.dao]' package. Please check your configuration. 2025-07-07 16:02:14.387 [main] WARN org.mybatis.spring.mapper.ClassPathMapperScanner:44 - No MyBatis mapper was found in '[com.pty.authsync.dao]' package. Please check your configuration. 2025-07-07 16:02:14.518 [main] WARN org.mybatis.spring.mapper.ClassPathMapperScanner:44 - No MyBatis mapper was found in '[com.pty.doc.dao]' package. Please check your configuration. 2025-07-07 16:02:14.676 [main] WARN org.mybatis.spring.mapper.ClassPathMapperScanner:44 - Skipping MapperFactoryBean with name 'wfTaskDao' and 'com.pty.workflow.dao.WfTaskDao' mapperInterface. Bean already defined with the same name! 2025-07-07 16:02:14.676 [main] WARN org.mybatis.spring.mapper.ClassPathMapperScanner:44 - Skipping MapperFactoryBean with name 'actTaskStatusDao' and 'com.pty.workflow.dao.ActTaskStatusDao' mapperInterface. Bean already defined with the same name! 2025-07-07 16:02:14.676 [main] WARN org.mybatis.spring.mapper.ClassPathMapperScanner:44 - Skipping MapperFactoryBean with name 'actRuExecutionDao' and 'com.pty.workflow.dao.ActRuExecutionDao' mapperInterface. Bean already defined with the same name! 2025-07-07 16:02:14.676 [main] WARN org.mybatis.spring.mapper.ClassPathMapperScanner:44 - Skipping MapperFactoryBean with name 'actHiVarInstDao' and 'com.pty.workflow.dao.ActHiVarInstDao' mapperInterface. Bean already defined with the same name! 2025-07-07 16:02:14.676 [main] WARN org.mybatis.spring.mapper.ClassPathMapperScanner:44 - Skipping MapperFactoryBean with name 'actRuIdentityLinkDao' and 'com.pty.workflow.dao.ActRuIdentityLinkDao' mapperIn
07-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值