关于spring boot自动注入出现Mapper Consider defining a bean of type 'xxx' in your configuration问题解决方案

版权声明:转载请链接 https://blog.csdn.net/DPnice/article/details/84028233

问题:

Mapper注解不能被识别,
Consider defining a bean of type 'XXX' in you configuration

参考其他博客得到如下解决办法:
在指定的application类上加上这么一行注解,手动指定application类要扫描哪些包下的注解

@SpringBootApplication(scanBasePackages = {"com.example"})  

但是这样会导致其他注解没有被识别到,输入多个参数后又和原来的错误一样了。

解决办法:

application类上加上:

@MapperScan(value = "com.example.demo.mapper")

参考:
https://blog.csdn.net/a532672728/article/details/77702772

猜你喜欢

转载自blog.csdn.net/DPnice/article/details/84028233
今日推荐