这几天准备在spring boot上调用文心一言api,
遇到了一个问题,描述如下:
Description:
A component required a bean of type 'com.gearwenxin.client.ernie.ErnieBotClient' that could not be found.
Action:
Consider defining a bean of type 'com.gearwenxin.client.ernie.ErnieBotClient' in your configuration.
去网上寻求帮助,让我去扫描对应类所在的包
@ComponentScan(basePackages = "")
但是加了这一句之后还是报错
之后又花了很多时间解决不了。
然后我在想是不是扫描这个包他过于’具体‘,导致与这个类关联的其他类没有扫进去,
之后我修改了代码如下(扩大范围):
然后就成功运行了。
我不知道我的分析是否正确,如有错,请各位大佬指正。