Unsatisfied dependency expressed through field 'baseMapper'解决方法
问题
项目报异常:
1 | Unsatisfied dependency expressed through field 'articleService'; |
解决方法
应该是Mapper没有被扫描到
方法一:添加@MapperScan("xxx.xxx.xxx")注解, xxx.xxx.xxx就是你Mapper所在的包
1
2
3
4
5
6
7
public class BaiLangBlogApplication {
public static void main(String[] args) {
SpringApplication.run(BaiLangBlogApplication.class, args);
}
}方法二:在mapper接口上面添加@Mapper注解
1
2
3
4
public interface ArticleMapper extends BaseMapper<Article> {
}重新编译项目,编译成功
参考链接
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 WhiteWaves!