The bean ‘uc-service.FeignClientSpecification’ could not be registered. A bean with that name has already been defined and overriding is disabled.**
报错信息:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-03-19 15:37:36.516 --- [ main] :
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'uc-service.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
可能原因:在SpringBoot 2.1之前,这个配置默认就是true,而在2.1做了更改。
设置为true后,因为FeignClientSpecification的原因,FeignClient注解的configuration参数会被覆盖。
解决:
1.
@FeignClient(name="common-service", contextId = "example")
或@FeignClient(name="common-service", contextId = "exp")
2.在application.yml中配置:
spring: main:
allow-bean-definition-overriding: true
版权声明:本文为weixin_47396087原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。