One - One Code All

Blog Content

解决required a bean of type ‘XXX’ that could not be found.的问题

Java   2020-11-10 18:11:01


这个问题可能有好些原因,不同的项目有不同的原因。


今天遇到是在导入处理阿里云OSS包的时候出现的,提示:

 required a bean of type ' objectstorage.ObjectStorageClient' that could not be found.


这个问题的原因是包扫描不到!


解决方法,在启动类上面添加注解:

@ComponentScan(basePackages="com.onecodeall")


ObjectStorageClient 在这个包com.onecodeall的子包下面。



上一篇:springboot Feign请求失败异常feign.FeignException.errorExecuting
下一篇:给java应用加上prometheus,解决/health访问报错Unauthorized

The minute you think of giving up, think of the reason why you held on so long.