
用MybtisPlus的代码生成器生成了impl,只在yml里配置了mapper的包路径,以及在主启动类上加了@MapperScan("mapper包路径"),启动,就报这个错,一直报这个错。
错误信息:
1.org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'stuInfoScoreController': Unsatisfied dependency expressed through field 'stuInfoScoreService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'stuInfoScoreServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.jianglina.peixuncore.mapper.StuInfoScoreMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2.Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'stuInfoScoreServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.jianglina.peixuncore.mapper.StuInfoScoreMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
3.NoSuchBeanDefinitionException: No qualifying bean of type 'com.peixuncore.mapper.StuInfoScoreMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
用过很多方法:
1.pom里的依赖版本问题 ——改的跟别人运行成功的版本一样也没用
2.在impl上写@Service("stuInfoScoreServiceImpl")或者@Service("stuInfoScoreService")——不好使
3.mapper路径——没问题
4.能在网上搜到的办法)——都不好使
困住我好几天了 我甚至连代码生成器都核对了好几遍 重写了好多遍还是这个问题 啥也不写就报这个错
在里面想注入个mapper也注入不进来
我不知道原因 也不知道咋解决,求指点。