SpringCloud启动错误记录
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'xxx.FeignClientSpecification' could not be registered. A bean with that name has already been defined and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
原因
多个feign接口使用@FeignClient注解调用同一个名称的微服务时,启动时会引发此异常。
解决方法
方法一: 将feign接口合并。
方法二: 在配置文件中增加配置 spring.main.allow-bean-definition-overriding=true
方法三: 在@FeignClient注解上增加contextId属性,确保每个feign client的contextId唯一。如@FeignClient(name = "服务名", contextId="唯一名称")