springboot-遇到的错误

1、Field userMapper in com.yanan.outjob.controller.SysUserController required a bean of type 'com.yanan.outjob.dao.SysUserMapper' that could not be found.

  mapper注入失败

  解决方法启动类添加扫描注解 @MapperScan("com.yanan.outjob.dao")

 2、配置多个数据源报错(more than one 'primary' bean found among candidates)

   控制台输出:more than one 'primary' bean found among candidates: 

  很明显,出现了不止一个的“primary”,找出primary出现的位置。多个数据源配置文件在其中两个文件中用到了

@Primary注解,试着删掉其中一个文件中的@Primary注解,项目正常启动
借鉴:https://blog.csdn.net/weixin_42074377/article/details/83615895
原文地址:https://www.cnblogs.com/zqyw/p/10863204.html