contextId的使用一般是调用同一个服务,但是分多个接口

比如调用同一个member服务可以通过contextId来区分开,否则就会报错bean冲突

1
2
3
4
5
6
7
8
/**
* @author 小五
*/
@FeignClient(contextId = "MemberAFeign", value = ServiceNameConstants.MEMBER_SERVICE,
fallbackFactory = MemberFeignAFallbackFactory.class)
public interface MemberAFeign {
...
}
1
2
3
4
5
6
7
8
/**
* @author 小五
*/
@FeignClient(contextId = "MemberBFeign", value = ServiceNameConstants.MEMBER_SERVICE,
fallbackFactory = MemberFeignBFallbackFactory.class)
public interface MemberBFeign {
...
}