1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

remote all hystrix,zuul,ribbon

This commit is contained in:
theonefx 2021-03-17 16:29:06 +08:00
parent c3aab6275f
commit ed9d659d64
17 changed files with 11 additions and 460 deletions

View File

@ -15,7 +15,7 @@ Spring Cloud Alibaba 致力于提供微服务开发的一站式解决方案。
## 主要功能
* **服务限流降级**:默认支持 WebServlet、WebFlux, OpenFeign、RestTemplate、Spring Cloud Gateway, Zuul, Dubbo 和 RocketMQ 限流降级功能的接入,可以在运行时通过控制台实时修改限流降级规则,还支持查看限流降级 Metrics 监控。
* **服务限流降级**:默认支持 WebServlet、WebFlux, OpenFeign、RestTemplate、Spring Cloud Gateway, Dubbo 和 RocketMQ 限流降级功能的接入,可以在运行时通过控制台实时修改限流降级规则,还支持查看限流降级 Metrics 监控。
* **服务注册与发现**:适配 Spring Cloud 服务注册与发现标准,默认集成了 Ribbon 的支持。
* **分布式配置管理**:支持分布式系统中的外部化配置,配置更改时自动刷新。
* **消息驱动能力**:基于 Spring Cloud Stream 为微服务应用构建消息驱动能力。

View File

@ -252,7 +252,6 @@
<failsOnError>true</failsOnError>
<failOnViolation>true</failOnViolation>
<violationSeverity>warning</violationSeverity>
<skip>true</skip>
</configuration>
</execution>
</executions>

View File

@ -102,11 +102,6 @@
<version>${sentinel.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-zuul-adapter</artifactId>
<version>${sentinel.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-spring-cloud-gateway-adapter</artifactId>

View File

@ -254,29 +254,6 @@ NOTE: 默认情况下xml 格式是不支持的。需要添加 `jackson-datafo
关于 Sentinel 动态数据源的实现原理,参考: https://github.com/alibaba/Sentinel/wiki/%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%99%E6%89%A9%E5%B1%95[动态规则扩展]
=== Zuul 支持
https://github.com/alibaba/Sentinel/wiki/%E7%BD%91%E5%85%B3%E9%99%90%E6%B5%81[参考 Sentinel 网关限流]
若想跟 Sentinel Starter 配合使用,需要加上 `spring-cloud-alibaba-sentinel-gateway` 依赖,同时需要添加 `spring-cloud-starter-netflix-zuul` 依赖来让 `spring-cloud-alibaba-sentinel-gateway` 模块里的 Zuul 自动化配置类生效:
```xml
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-sentinel-gateway</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>
```
=== Spring Cloud Gateway 支持
https://github.com/alibaba/Sentinel/wiki/%E7%BD%91%E5%85%B3%E9%99%90%E6%B5%81[参考 Sentinel 网关限流]
@ -438,9 +415,6 @@ Spring Cloud Alibaba Sentinel 提供了这些配置选项
|`spring.cloud.sentinel.servlet.block-page`| 自定义的跳转 URL当请求被限流时会自动跳转至设定好的 URL |
|`spring.cloud.sentinel.flow.cold-factor`| https://github.com/alibaba/Sentinel/wiki/%E9%99%90%E6%B5%81---
%E5%86%B7%E5%90%AF%E5%8A%A8[冷启动因子] |3
|`spring.cloud.sentinel.zuul.order.pre`| SentinelZuulPreFilter 的 order | 10000
|`spring.cloud.sentinel.zuul.order.post`| SentinelZuulPostFilter 的 order | 1000
|`spring.cloud.sentinel.zuul.order.error`| SentinelZuulErrorFilter 的 order | -1
|`spring.cloud.sentinel.scg.fallback.mode`| Spring Cloud Gateway 熔断后的响应模式(选择 `redirect` or `response`) |
|`spring.cloud.sentinel.scg.fallback.redirect`| Spring Cloud Gateway 响应模式为 'redirect' 模式对应的重定向 URL |
|`spring.cloud.sentinel.scg.fallback.response-body`| Spring Cloud Gateway 响应模式为 'response' 模式对应的响应内容 |

View File

@ -255,29 +255,6 @@ NOTE: XML format is not supported by default. To make it effective, you need to
To learn more about how dynamic data sources work in Sentinel, refer to https://github.com/alibaba/Sentinel/wiki/%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%99%E6%89%A9%E5%B1%95[Dynamic Rule Extension].
=== Support Zuul
Refer https://github.com/alibaba/Sentinel/wiki/API-Gateway-Flow-Control[API Gateway Flow Control]
If you want to use Sentinel Starter with Zuul, you need to add the `spring-cloud-alibaba-sentinel-gateway` dependency, and you need to add the `spring-cloud-starter-netflix-zuul` dependency to let Zuul AutoConfiguration class in the gateway module takes effect:
```xml
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-sentinel-gateway</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>
```
=== Support Spring Cloud Gateway
Refer https://github.com/alibaba/Sentinel/wiki/API-Gateway-Flow-Control[API Gateway Flow Control]
@ -438,9 +415,6 @@ The following table shows all the configurations of Spring Cloud Alibaba Sentine
|`spring.cloud.sentinel.log.switch-pid`|If PID is required for Sentinel log file names|false
|`spring.cloud.sentinel.servlet.blockPage`| Customized redirection URL. When rate limited, the request will be redirected to the pre-defined URL |
|`spring.cloud.sentinel.flow.coldFactor`| https://github.com/alibaba/Sentinel/wiki/%E9%99%90%E6%B5%81---%E5%86%B7%E5%90%AF%E5%8A%A8[ColdFactor] |3
|`spring.cloud.sentinel.zuul.order.pre`| The order of SentinelZuulPreFilter | 10000
|`spring.cloud.sentinel.zuul.order.post`| The order of SentinelZuulPostFilter | 1000
|`spring.cloud.sentinel.zuul.order.error`| The order of SentinelZuulErrorFilter | -1
|`spring.cloud.sentinel.scg.fallback.mode`| Response mode after Spring Cloud Gateway circuit break (select `redirect` or `response`) |
|`spring.cloud.sentinel.scg.fallback.redirect`| Spring Cloud Gateway response mode is the redirect URL corresponding to 'redirect' mode |
|`spring.cloud.sentinel.scg.fallback.response-body`| Spring Cloud Gateway response mode is response content corresponding to 'response' mode |

View File

@ -32,10 +32,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.DefaultResponse;
import org.springframework.cloud.client.loadbalancer.EmptyResponse;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.client.loadbalancer.Response;
import org.springframework.cloud.client.loadbalancer.DefaultResponse;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
import org.springframework.cloud.loadbalancer.core.NoopServiceInstanceListSupplier;
import org.springframework.cloud.loadbalancer.core.ReactorServiceInstanceLoadBalancer;
@ -77,8 +77,7 @@ public class ConsumerSCLBApplication {
}
@Configuration
@LoadBalancerClient(value = "service-provider",
configuration = MyLoadBalancerConfiguration.class)
@LoadBalancerClient(value = "service-provider", configuration = MyLoadBalancerConfiguration.class)
class MySCLBConfiguration {
}
@ -102,9 +101,9 @@ public class ConsumerSCLBApplication {
this.random = new Random();
}
@Override
public Mono<Response<ServiceInstance>> choose(org.springframework.cloud.client.loadbalancer.Request request) {
public Mono<Response<ServiceInstance>> choose(
org.springframework.cloud.client.loadbalancer.Request request) {
ServiceInstanceListSupplier supplier = serviceInstanceListSupplierProvider
.getIfAvailable(NoopServiceInstanceListSupplier::new);
@ -129,8 +128,7 @@ public class ConsumerSCLBApplication {
}
}
@FeignClient(name = "service-provider", fallback = EchoServiceFallback.class,
configuration = FeignConfiguration.class)
@FeignClient(name = "service-provider", fallback = EchoServiceFallback.class, configuration = FeignConfiguration.class)
public interface EchoService {
@GetMapping("/echo/{str}")

View File

@ -33,11 +33,6 @@
<artifactId>sentinel-parameter-flow-control</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-zuul-adapter</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-spring-cloud-gateway-adapter</artifactId>

View File

@ -17,28 +17,17 @@
package com.alibaba.cloud.sentinel.gateway;
import com.alibaba.cloud.sentinel.gateway.scg.SentinelGatewayProperties;
import com.alibaba.cloud.sentinel.gateway.zuul.SentinelZuulProperties;
/**
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
*/
public final class ConfigConstants {
/**
* Netflix Zuul type.
*/
public static final String APP_TYPE_ZUUL_GATEWAY = "12";
/**
* Spring Cloud Gateway type.
*/
public static final String APP_TYPE_SCG_GATEWAY = "11";
/**
* ConfigurationProperties for {@link SentinelZuulProperties}.
*/
public static final String ZUUL_PREFIX = "spring.cloud.sentinel.zuul";
/**
* ConfigurationProperties for {@link SentinelGatewayProperties}.
*/

View File

@ -1,62 +0,0 @@
/*
* Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.cloud.sentinel.gateway.zuul;
import java.util.Map;
import com.alibaba.csp.sentinel.adapter.gateway.zuul.fallback.DefaultBlockFallbackProvider;
import com.alibaba.csp.sentinel.adapter.gateway.zuul.fallback.ZuulBlockFallbackManager;
import com.alibaba.csp.sentinel.adapter.gateway.zuul.fallback.ZuulBlockFallbackProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.util.CollectionUtils;
/**
* @author tiger
*/
public class FallBackProviderHandler implements SmartInitializingSingleton {
private static final Logger logger = LoggerFactory
.getLogger(FallBackProviderHandler.class);
private final DefaultListableBeanFactory beanFactory;
public FallBackProviderHandler(DefaultListableBeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
@Override
public void afterSingletonsInstantiated() {
Map<String, ZuulBlockFallbackProvider> providerMap = beanFactory
.getBeansOfType(ZuulBlockFallbackProvider.class);
if (!CollectionUtils.isEmpty(providerMap)) {
providerMap.forEach((k, v) -> {
logger.info("[Sentinel Zuul] Register provider name:{}, instance: {}", k,
v);
ZuulBlockFallbackManager.registerProvider(v);
});
}
else {
logger.info("[Sentinel Zuul] Register default fallback provider. ");
ZuulBlockFallbackManager.registerProvider(new DefaultBlockFallbackProvider());
}
}
}

View File

@ -1,102 +0,0 @@
///*
// * Copyright 2013-2018 the original author or authors.
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// * https://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
//
//package com.alibaba.cloud.sentinel.gateway.zuul;
//
//import java.util.Optional;
//
//import javax.annotation.PostConstruct;
//
//import com.alibaba.cloud.sentinel.gateway.ConfigConstants;
//import com.alibaba.csp.sentinel.adapter.gateway.zuul.callback.RequestOriginParser;
//import com.alibaba.csp.sentinel.adapter.gateway.zuul.callback.ZuulGatewayCallbackManager;
//import com.alibaba.csp.sentinel.adapter.gateway.zuul.filters.SentinelZuulErrorFilter;
//import com.alibaba.csp.sentinel.adapter.gateway.zuul.filters.SentinelZuulPostFilter;
//import com.alibaba.csp.sentinel.adapter.gateway.zuul.filters.SentinelZuulPreFilter;
//import com.alibaba.csp.sentinel.config.SentinelConfig;
//import com.netflix.zuul.http.ZuulServlet;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.support.DefaultListableBeanFactory;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
//import org.springframework.boot.context.properties.EnableConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
///**
// * Sentinel Spring Cloud Zuul AutoConfiguration.
// *
// * @author tiger
// */
//@Configuration(proxyBeanMethods = false)
//@ConditionalOnClass(ZuulServlet.class)
//@ConditionalOnProperty(prefix = ConfigConstants.ZUUL_PREFIX, name = "enabled",
// havingValue = "true", matchIfMissing = true)
//@EnableConfigurationProperties(SentinelZuulProperties.class)
//public class SentinelZuulAutoConfiguration {
//
// private static final Logger logger = LoggerFactory
// .getLogger(SentinelZuulAutoConfiguration.class);
//
// @Autowired
// private Optional<RequestOriginParser> requestOriginParserOptional;
//
// @Autowired
// private SentinelZuulProperties zuulProperties;
//
// @PostConstruct
// private void init() {
// requestOriginParserOptional
// .ifPresent(ZuulGatewayCallbackManager::setOriginParser);
// System.setProperty(SentinelConfig.APP_TYPE_PROP_KEY,
// String.valueOf(ConfigConstants.APP_TYPE_ZUUL_GATEWAY));
// }
//
// @Bean
// @ConditionalOnMissingBean
// public SentinelZuulPreFilter sentinelZuulPreFilter() {
// logger.info("[Sentinel Zuul] register SentinelZuulPreFilter {}",
// zuulProperties.getOrder().getPre());
// return new SentinelZuulPreFilter(zuulProperties.getOrder().getPre());
// }
//
// @Bean
// @ConditionalOnMissingBean
// public SentinelZuulPostFilter sentinelZuulPostFilter() {
// logger.info("[Sentinel Zuul] register SentinelZuulPostFilter {}",
// zuulProperties.getOrder().getPost());
// return new SentinelZuulPostFilter(zuulProperties.getOrder().getPost());
// }
//
// @Bean
// @ConditionalOnMissingBean
// public SentinelZuulErrorFilter sentinelZuulErrorFilter() {
// logger.info("[Sentinel Zuul] register SentinelZuulErrorFilter {}",
// zuulProperties.getOrder().getError());
// return new SentinelZuulErrorFilter(zuulProperties.getOrder().getError());
// }
//
// @Bean
// public FallBackProviderHandler fallBackProviderHandler(
// DefaultListableBeanFactory beanFactory) {
// return new FallBackProviderHandler(beanFactory);
// }
//
//}

View File

@ -1,89 +0,0 @@
/*
* Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.cloud.sentinel.gateway.zuul;
import com.alibaba.cloud.sentinel.gateway.ConfigConstants;
import com.alibaba.csp.sentinel.adapter.gateway.zuul.constants.ZuulConstant;
import com.alibaba.csp.sentinel.adapter.gateway.zuul.filters.SentinelZuulErrorFilter;
import com.alibaba.csp.sentinel.adapter.gateway.zuul.filters.SentinelZuulPostFilter;
import com.alibaba.csp.sentinel.adapter.gateway.zuul.filters.SentinelZuulPreFilter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
/**
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
*/
@ConfigurationProperties(prefix = ConfigConstants.ZUUL_PREFIX)
public class SentinelZuulProperties {
@NestedConfigurationProperty
private SentinelZuulProperties.Order order = new SentinelZuulProperties.Order();
public Order getOrder() {
return order;
}
public SentinelZuulProperties setOrder(Order order) {
this.order = order;
return this;
}
public static class Order {
/**
* The order of {@link SentinelZuulPreFilter}.
*/
private int pre = 10000;
/**
* The order of {@link SentinelZuulPostFilter}.
*/
private int post = ZuulConstant.SEND_RESPONSE_FILTER_ORDER;
/**
* The order of {@link SentinelZuulErrorFilter}.
*/
private int error = -1;
public int getPre() {
return pre;
}
public void setPre(int pre) {
this.pre = pre;
}
public int getPost() {
return post;
}
public void setPost(int post) {
this.post = post;
}
public int getError() {
return error;
}
public void setError(int error) {
this.error = error;
}
}
}

View File

@ -38,14 +38,6 @@ import org.springframework.context.annotation.Scope;
@AutoConfigureBefore(FeignAutoConfiguration.class)
public class SeataFeignClientAutoConfiguration {
// @Bean
// @Scope("prototype")
// @ConditionalOnClass(name = "com.netflix.hystrix.HystrixCommand")
// @ConditionalOnProperty(name = "feign.hystrix.enabled", havingValue = "true")
// Feign.Builder feignHystrixBuilder(BeanFactory beanFactory) {
// return SeataHystrixFeignBuilder.builder(beanFactory);
// }
@Bean
@Scope("prototype")
@ConditionalOnClass(name = "com.alibaba.csp.sentinel.SphU")

View File

@ -24,10 +24,7 @@ import org.springframework.beans.factory.BeanFactory;
import org.springframework.cloud.client.loadbalancer.LoadBalancerProperties;
import org.springframework.cloud.loadbalancer.blocking.client.BlockingLoadBalancerClient;
import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
//import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
import org.springframework.cloud.openfeign.loadbalancer.FeignBlockingLoadBalancerClient;
//import org.springframework.cloud.openfeign.ribbon.CachingSpringLoadBalancerFactory;
//import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient;
/**
* @author xiaojing
@ -39,9 +36,6 @@ public class SeataFeignObjectWrapper {
private final BeanFactory beanFactory;
// private CachingSpringLoadBalancerFactory cachingSpringLoadBalancerFactory;
// private SpringClientFactory springClientFactory;
SeataFeignObjectWrapper(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
@ -49,11 +43,6 @@ public class SeataFeignObjectWrapper {
Object wrap(Object bean) {
if (bean instanceof Client && !(bean instanceof SeataFeignClient)) {
// if (bean instanceof LoadBalancerFeignClient) {
// LoadBalancerFeignClient client = ((LoadBalancerFeignClient) bean);
// return new SeataLoadBalancerFeignClient(client.getDelegate(), factory(),
// clientFactory(), this);
// }
if (bean instanceof FeignBlockingLoadBalancerClient) {
FeignBlockingLoadBalancerClient client = (FeignBlockingLoadBalancerClient) bean;
return new SeataFeignBlockingLoadBalancerClient(client.getDelegate(),
@ -66,21 +55,4 @@ public class SeataFeignObjectWrapper {
}
return bean;
}
// CachingSpringLoadBalancerFactory factory() {
// if (this.cachingSpringLoadBalancerFactory == null) {
// this.cachingSpringLoadBalancerFactory = this.beanFactory
// .getBean(CachingSpringLoadBalancerFactory.class);
// }
// return this.cachingSpringLoadBalancerFactory;
// }
// SpringClientFactory clientFactory() {
// if (this.springClientFactory == null) {
// this.springClientFactory = this.beanFactory
// .getBean(SpringClientFactory.class);
// }
// return this.springClientFactory;
// }
}

View File

@ -1,38 +0,0 @@
///*
// * Copyright 2013-2018 the original author or authors.
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// * https://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
//
//package com.alibaba.cloud.seata.feign;
//
//import feign.Feign;
//import feign.Retryer;
//import feign.hystrix.HystrixFeign;
//
//import org.springframework.beans.factory.BeanFactory;
//
///**
// * @author xiaojing
// */
//final class SeataHystrixFeignBuilder {
//
// private SeataHystrixFeignBuilder() {
// }
//
// static Feign.Builder builder(BeanFactory beanFactory) {
// return HystrixFeign.builder().retryer(Retryer.NEVER_RETRY)
// .client(new SeataFeignClient(beanFactory));
// }
//
//}

View File

@ -1,45 +0,0 @@
///*
// * Copyright 2013-2018 the original author or authors.
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// * https://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
//
//package com.alibaba.cloud.seata.feign;
//
//import java.io.IOException;
//
//import feign.Client;
//import feign.Request;
//import feign.Response;
//
//
///**
// * @author xiaojing
// * @author yuhuangbin
// */
//public class SeataLoadBalancerFeignClient extends LoadBalancerFeignClient {
//
// SeataLoadBalancerFeignClient(Client delegate,
// CachingSpringLoadBalancerFactory lbClientFactory,
// SpringClientFactory clientFactory,
// SeataFeignObjectWrapper seataFeignObjectWrapper) {
// super((Client) seataFeignObjectWrapper.wrap(delegate), lbClientFactory,
// clientFactory);
// }
//
// @Override
// public Response execute(Request request, Request.Options options) throws IOException {
// return super.execute(request, options);
// }
//
//}

View File

@ -37,10 +37,8 @@ import org.springframework.context.support.GenericApplicationContext;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;
import static org.springframework.beans.factory.BeanFactory.FACTORY_BEAN_PREFIX;
/**
* {@link Feign.Builder} like {@link HystrixFeign.Builder}.
* {@link Feign.Builder}.
*
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
*/

View File

@ -23,8 +23,6 @@ import java.lang.reflect.Proxy;
import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.cloud.openfeign.FallbackFactory;
import com.alibaba.csp.sentinel.Entry;
import com.alibaba.csp.sentinel.EntryType;
import com.alibaba.csp.sentinel.SphU;
@ -36,6 +34,8 @@ import feign.InvocationHandlerFactory.MethodHandler;
import feign.MethodMetadata;
import feign.Target;
import org.springframework.cloud.openfeign.FallbackFactory;
import static feign.Util.checkNotNull;
/**
@ -72,7 +72,8 @@ public class SentinelInvocationHandler implements InvocationHandler {
if ("equals".equals(method.getName())) {
try {
Object otherHandler = args.length > 0 && args[0] != null
? Proxy.getInvocationHandler(args[0]) : null;
? Proxy.getInvocationHandler(args[0])
: null;
return equals(otherHandler);
}
catch (IllegalArgumentException e) {