Skip to content

Commit

Permalink
fix:fix feign url bug when using sleuth. (#1120)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyeBeFreeman authored Sep 16, 2023
1 parent 4f2a387 commit 0db7b3b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 82 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

- [fix:the polaris config relation non-daemon thread should stop when application fails to start.](https://github.com/Tencent/spring-cloud-tencent/pull/1102)
- [Refactoring:remove invalid @AutoConfigureAfter and @AutoConfigureBefore from discovery client automatic configuration.](https://github.com/Tencent/spring-cloud-tencent/pull/1116)
- [fix:fix feign url bug when using sleuth.](https://github.com/Tencent/spring-cloud-tencent/pull/1120)
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private Object wrapper(Object bean) {
delegate = ((FeignBlockingLoadBalancerClient) bean).getDelegate();
}
if (delegate != null) {
return new EnhancedFeignBlockingLoadBalancerClient(createPolarisFeignClient(delegate),
return new FeignBlockingLoadBalancerClient(createPolarisFeignClient(delegate),
factory.getBean(BlockingLoadBalancerClient.class),
factory.getBean(LoadBalancerClientFactory.class),
factory.getBeanProvider(LoadBalancerFeignRequestTransformer.class).stream().toList()
Expand All @@ -75,8 +75,7 @@ private Object wrapper(Object bean) {
}

private boolean isNeedWrap(Object bean) {
return bean instanceof Client && !(bean instanceof EnhancedFeignClient)
&& !(bean instanceof EnhancedFeignBlockingLoadBalancerClient);
return bean instanceof Client && !(bean instanceof EnhancedFeignClient);
}

private EnhancedFeignClient createPolarisFeignClient(Client delegate) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ public void testPostProcessBeforeInitialization() {
// isNeedWrap(bean) == false
Object bean1 = new Object();
Object bean = enhancedFeignBeanPostProcessor.postProcessBeforeInitialization(bean1, "bean1");
assertThat(bean).isNotInstanceOfAny(
EnhancedFeignClient.class,
EnhancedFeignBlockingLoadBalancerClient.class);
assertThat(bean).isNotInstanceOfAny(EnhancedFeignClient.class);

// bean instanceOf Client.class
Client bean2 = mock(Client.class);
Expand All @@ -86,6 +84,7 @@ public void testPostProcessBeforeInitialization() {
FeignBlockingLoadBalancerClient bean4 = mock(FeignBlockingLoadBalancerClient.class);
doReturn(mock(Client.class)).when(bean4).getDelegate();
bean = enhancedFeignBeanPostProcessor.postProcessBeforeInitialization(bean4, "bean4");
assertThat(bean).isInstanceOf(EnhancedFeignBlockingLoadBalancerClient.class);
assertThat(bean).isInstanceOf(FeignBlockingLoadBalancerClient.class);
assertThat(((FeignBlockingLoadBalancerClient) bean).getDelegate()).isInstanceOf(EnhancedFeignClient.class);
}
}

This file was deleted.

0 comments on commit 0db7b3b

Please sign in to comment.