*************************** APPLICATION FAILED TO START *************************** Description: The bean 'xxxxx.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
报错场景
错误信息说 xxxxx.FeignClientSpecification 重复的bean 启动报错
让我把配置文件的允许重复bean改为true
但是在项目中全局搜索并没有查到xxxxx.FeignClientSpecification
配置文件也已经修改为 true
也对 contextId 起了名字
目前状况是改成什么名字就报什么名字的错
解决方式
原因
项目A和项目B都有feign使用的情况
当前项目B依赖了项目A
如果两个项目中的启动类中都有@EnableFeignClients这个注解
则会出现bean重复的情况
解决方案是保留项目A的启动类@EnableFeignClients注解,删除项目B启动类中@EnableFeignClients注解
实际原因建议按照依赖关系排查是否依赖关系中带有重复的@EnableFeignClients注解