开发者社区> 问答> 正文

通用Mapper自定接口注入失败?报错

报错内容

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dynamicFormContentServiceImpl': Unsatisfied dependency expressed through field 'mapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.cofe.ssm.mapper.base.CofeBaseMapper<com.cofe.common.pojo.DynamicFormContent>' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.cofe.ssm.mapper.base.CofeBaseMapper<com.cofe.common.pojo.DynamicFormContent>' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

spring配置

<bean class="tk.mybatis.spring.mapper.MapperScannerConfigurer">
	<property name="basePackage" value="com.cofe.ssm.mapper"/>
	<property name="markerInterface" value="com.cofe.ssm.mapper.base.CofeBaseMapper"/>
	<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
	<property name="properties">
		<value>
			mappers=tk.mybatis.mapper.common.Mapper,com.cofe.ssm.mapper.base.CofeBaseMapper
		</value>
	</property>
</bean>

接口

public interface CofeBaseMapper<T> extends BaseMapper<T>,IdsMapper<T>,Marker {
}

框架版本

spring 4.1.3.RELEASE
mybatis 3.2.8
mybatis.spring  1.2.2
tk.mybatis 3.3.8

配置参照官方文档来的,但是就是报错,找不到原因,求大佬帮助

展开
收起
爱吃鱼的程序员 2020-06-08 10:01:04 774 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    @ Liuzh_533

    昨晚解决了,把所有继承默认Mapper<T>的接口全部改成自定义的Mapper<T>接口就不会报错了,但是我记得以前的确可以混用
    2020-06-08 10:01:18
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
继承与功能组合 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载