Error creating bean with name xxxxController

本文最后更新于:2 年前

记录并整理开发中遇到的报错信息,会先做记录,后续整理。

报错信息

1
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'noticeController': Unsatisfied dependency expressed through field 'noticeService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'noticeServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.ajie.zndcxtwxapi.mapper.NoticeMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

解决

添加@Mapper注解

就是因为没有扫描到Mapper类导致报错

在启动类添加 MapperScanner()指定包名也可以。


本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!