Service对象创建失败

错误:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'roleService': Unsatisfied dependency expressed through field 'baseMapper': No qualifying bean of type [com.shsxt.base.BaseMapper] is defined: expected single matching bean but found 2: roleMapper,userRoleMapper; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.shsxt.base.BaseMapper] is defined: expected single matching bean but found 2: roleMapper,userRoleMapper

错误结构

Service对象创建失败的原因是,service和controller继承了baseservice和basecontroller,但是mapper没有继承basemapper(自己封装的三个base包都要继承 )也就缺失了basemapper对应的XML文件,导致service对象创建失败

正确的结构

原文地址:https://www.cnblogs.com/DemonQin/p/13552323.html