The bean 'GOODS-SERVICE1.FeignClientSpecification', defined in null, could not be registered
起因
在使用Feign调用时,启动Service报错
异常信息
Description:
The bean 'GOODS-SERVICE1.FeignClientSpecification', defined in null, could not be registered. A bean with that name has already been defined in null and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
解决方案一(改配置)
按照提示,把spring.main.allow-bean-definition-overriding设置为true,
允许定义同名的bean存在。
解决方案二
@EnableFeignClients(basePackages = "com.doit.mall.api.goods.feign")
把对应扫描包下的接口的@FeignClient(name="GOODS-SERVICE")定义成不一样的。
比如我在这个包下有AlbumFeign,BrandFeign,CategoryBrandFeign,但是都是指定GOODS-SERVICE的,就没必要把所有接口合起来,统一指定为GOODS-SERVICE。所以建议改配置比较方便。
你的出现让我有了杂念