一、FeignClient注解
FeignClient注解被@Target(ElementType.TYPE)修饰,表示FeignClient注解的作用目标在接口上

/*

  • Copyright 2013-2016 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
  •  http://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 org.springframework.cloud.openfeign;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.springframework.core.annotation.AliasFor;

/**

  • Annotation for interfaces declaring that a REST client with that interface should be

  • created (e.g. for autowiring into another component). If ribbon is available it will be

  • used to load balance the backend requests, and the load balancer can be configured

  • using a @RibbonClient with the same name (i.e. value) as the feign client.

  • @author Spencer Gibb

  • @author Venil Noronha
    */
    @Target(ElementType.TYPE)
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    public @interface FeignClient {

    /**

    • The name of the service with optional protocol prefix. Synonym for {@link #name()
    • name}. A name must be specified for all clients, whether or not a url is provided.
    • Can be specified as property key, eg: ${propertyKey}.
      */
      @AliasFor(“name”)
      String value() default “”;

    /**

    • The service id with optional protocol prefix. Synonym for {@link #value() value}.
    • @deprecated use {@link #name() name} instead
      */
      @Deprecated
      String serviceId() default “”;

    /**

    • The service id with optional protocol prefix. Synonym for {@link #value() value}.
      */
      @AliasFor(“value”)
      String name() default “”;

    /**

    • Sets the @Qualifier value for the feign client.
      */
      String qualifier() default “”;

    /**

    • An absolute URL or resolvable hostname (the protocol is optional).
      */
      String url() default “”;

    /**

    • Whether 404s should be decoded instead of throwing FeignExceptions
      */
      boolean decode404() default false;

    /**

    • A custom @Configuration for the feign client. Can contain override
    • @Bean definition for the pieces that make up the client, for instance
    • {@link feign.codec.Decoder}, {@link feign.codec.Encoder}, {@link feign.Contract}.
    • @see FeignClientsConfiguration for the defaults
      */
      Class<?>[] configuration() default {};

    /**

    • Fallback class for the specified Feign client interface. The fallback class must
    • implement the interface annotated by this annotation and be a valid spring bean.
      */
      Class<?> fallback() default void.class;

    /**

    • Define a fallback factory for the specified Feign client interface. The fallback
    • factory must produce instances of fallback classes that implement the interface
    • annotated by {@link FeignClient}. The fallback factory must be a valid spring
    • bean.
    • @see feign.hystrix.FallbackFactory for details.
      */
      Class<?> fallbackFactory() default void.class;

    /**

    • Path prefix to be used by all method-level mappings. Can be used with or without
    • @RibbonClient.
      */
      String path() default “”;

    /**

    • Whether to mark the feign proxy as a primary bean. Defaults to true.
      */
      boolean primary() default true;

}
声明接口之后,在代码中通过@Resource注入之后即可使用。@FeignClient标签的常用属性如下:

name:指定FeignClient的名称,如果项目使用了Ribbon,name属性会作为微服务的名称,用于服务发现
url: url一般用于调试,可以手动指定@FeignClient调用的地址
decode404:当发生http 404错误时,如果该字段位true,会调用decoder进行解码,否则抛出FeignException
configuration: Feign配置类,可以自定义Feign的Encoder、Decoder、LogLevel、Contract
fallback: 定义容错的处理类,当调用远程接口失败或超时时,会调用对应接口的容错逻辑,fallback指定的类必须实现@FeignClient标记的接口
fallbackFactory: 工厂类,用于生成fallback类示例,通过这个属性我们可以实现每个接口通用的容错逻辑,减少重复的代码
path: 定义当前FeignClient的统一前缀
二:实例
下面指定一个说话的接口,url配置的是同本地的前缀,name是要调用的微服务名称,在erurka启用下生效,此外还指定了失效转移的配置,使用的是Sentinel实现,详情见上篇文章

package cn.chinotan.feign;

import cn.chinotan.SaySomeThing;
import cn.chinotan.config.feign.FeignConfiguration;
import cn.chinotan.feign.fallback.SayServiceFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**

  • @program: test

  • @description: 说接口

  • @author: xingcheng

  • @create: 2019-01-19 18:05
    **/
    @FeignClient(name = “sayService”, url = “http://localhost:11111”, fallback = SayServiceFallback.class, configuration = FeignConfiguration.class)
    public interface SayService {

    /**

    • @param saySomeThing
    • @return
      */
      @RequestMapping(value = “/feign/hello”, method = RequestMethod.POST)
      SaySomeThing saySomeThing(@RequestBody SaySomeThing saySomeThing);

}
在使用fallback属性时,需要使用@Component注解

package cn.chinotan.feign.fallback;

import cn.chinotan.SaySomeThing;
import cn.chinotan.feign.SayService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**

  • @program: test

  • @description: say快速失败

  • @author: xingcheng

  • @create: 2019-01-19 18:18
    **/
    public class SayServiceFallback implements SayService {

    Logger logger = LoggerFactory.getLogger(SayServiceFallback.class);

    @Override
    public SaySomeThing saySomeThing(SaySomeThing saySomeThing) {
    SaySomeThing saySomeThingFail = new SaySomeThing();
    saySomeThingFail.setName(“错误”);
    saySomeThingFail.setWords(“错误的话”);
    logger.error(“调用失败”);
    return saySomeThingFail;
    }
    }
    接下是配置feign的配置信息

package cn.chinotan.config.feign;

import cn.chinotan.feign.fallback.EchoServiceFallback;
import cn.chinotan.feign.fallback.SayServiceFallback;
import feign.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**

  • @program: test

  • @description: FeignConfiguration

  • @author: xingcheng

  • @create: 2019-01-12 18:44
    **/
    @Configuration
    public class FeignConfiguration {
    @Bean
    public SayServiceFallback sayServiceFallback() {
    return new SayServiceFallback();
    }

    @Bean
    public Logger.Level feignLoggerLevel() {
    return Logger.Level.FULL;
    }
    }
    两个bean指定降级类和日志级别打印,并注入到spring上下文

每一个被创建的Feign客户端都会有一个logger。该logger默认的名称为Feign客户端对应的接口的全限定名。Feign日志记录只能响应DEBUG日志级别。

例如

feign日志

logging.level.cn.chinotan.feign: DEBUG
针对每一个Feign客户端,可以配置一个Logger.Level对象,通过该对象控制日志输出内容。

Logger.Level有如下几种选择:

NONE, 不记录日志 (默认)。

BASIC, 只记录请求方法和URL以及响应状态代码和执行时间。

HEADERS, 记录请求和应答的头的基本信息。

FULL, 记录请求和响应的头信息,正文和元数据。

之后配置异常报警信息,主要通过实现ErrorDecoder接口实现

package cn.chinotan.config.feign;

import feign.FeignException;
import feign.Response;
import feign.codec.ErrorDecoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;

import static feign.FeignException.errorStatus;

/**

  • @program: test

  • @description: feign调用异常统一处理

  • @author: xingcheng

  • @create: 2019-01-19 19:47
    **/
    @Configuration
    public class MyErrorDecoder implements ErrorDecoder {

    Logger logger = LoggerFactory.getLogger(MyErrorDecoder.class);

    @Override
    public Exception decode(String methodKey, Response response) {
    FeignException exception = errorStatus(methodKey, response);
    // 报警
    logger.error(“methodKey: {}, reason is {}”, methodKey, response.toString());
    return exception;
    }

}
三:运行

配置一个请求controller

package cn.chinotan.controller;

import cn.chinotan.SaySomeThing;
import cn.chinotan.feign.SayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**

  • @program: test

  • @description: 最简单的使用 Sentinel 的例子

  • @author: xingcheng

  • @create: 2019-01-20 18:01
    **/
    @RestController
    @RequestMapping("/feign")
    public class FeignController {

    @Autowired
    SayService sayService;

    @PostMapping(value = “/hello”)
    public SaySomeThing hello(@RequestBody SaySomeThing saySomeThing) {
    // throw new RuntimeException(“我是异常”);
    return saySomeThing;
    }

    @PostMapping(value = “/say”)
    public SaySomeThing echoFeign(@RequestBody SaySomeThing saySomeThing) {
    return sayService.saySomeThing(saySomeThing);
    }
    }
    运行结果:

日志打印:

INFO: log base dir is: /Users/xingcheng/logs/csp/
INFO: log name use pid is: false
2019-01-19 20:11:45.916 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] —> POST http://localhost:11111/feign/hello HTTP/1.1
2019-01-19 20:11:45.916 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] Content-Type: application/json;charset=UTF-8
2019-01-19 20:11:45.916 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] Content-Length: 36
2019-01-19 20:11:45.917 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing]
2019-01-19 20:11:45.917 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] {“name”:“chinotan”,“words”:“世界”}
2019-01-19 20:11:45.917 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] —> END HTTP (36-byte body)
2019-01-19 20:11:45.944 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] <— HTTP/1.1 200 (27ms)
2019-01-19 20:11:45.944 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] cache-control: no-cache, no-store, max-age=0, must-revalidate
2019-01-19 20:11:45.944 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] content-type: application/json;charset=UTF-8
2019-01-19 20:11:45.944 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] date: Sat, 19 Jan 2019 12:11:45 GMT
2019-01-19 20:11:45.944 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] expires: 0
2019-01-19 20:11:45.944 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] pragma: no-cache
2019-01-19 20:11:45.944 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] transfer-encoding: chunked
2019-01-19 20:11:45.944 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] x-content-type-options: nosniff
2019-01-19 20:11:45.945 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] x-frame-options: DENY
2019-01-19 20:11:45.945 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] x-xss-protection: 1; mode=block
2019-01-19 20:11:45.945 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing]
2019-01-19 20:11:45.951 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] {“name”:“chinotan”,“words”:“世界”}
2019-01-19 20:11:45.951 DEBUG 2932 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] <— END HTTP (36-byte body)
2019-01-19 20:37:41.552 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] —> POST http://localhost:11111/feign/hello HTTP/1.1
2019-01-19 20:37:41.552 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] Content-Type: application/json;charset=UTF-8
2019-01-19 20:37:41.552 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] Content-Length: 36
2019-01-19 20:37:41.552 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing]
2019-01-19 20:37:41.552 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] {“name”:“chinotan”,“words”:“世界”}
2019-01-19 20:37:41.552 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] —> END HTTP (36-byte body)
2019-01-19 20:37:41.559 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] <— HTTP/1.1 200 (7ms)
2019-01-19 20:37:41.559 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] cache-control: no-cache, no-store, max-age=0, must-revalidate
2019-01-19 20:37:41.560 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] content-type: application/json;charset=UTF-8
2019-01-19 20:37:41.560 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] date: Sat, 19 Jan 2019 12:37:41 GMT
2019-01-19 20:37:41.560 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] expires: 0
2019-01-19 20:37:41.560 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] pragma: no-cache
2019-01-19 20:37:41.560 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] transfer-encoding: chunked
2019-01-19 20:37:41.560 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] x-content-type-options: nosniff
2019-01-19 20:37:41.560 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] x-frame-options: DENY
2019-01-19 20:37:41.560 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] x-xss-protection: 1; mode=block
2019-01-19 20:37:41.560 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing]
2019-01-19 20:37:41.560 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] {“name”:“chinotan”,“words”:“世界”}
2019-01-19 20:37:41.560 DEBUG 2932 — [io-11111-exec-7] cn.chinotan.feign.SayService : [SayService#saySomeThing] <— END HTTP (36-byte body)
可以看到请求地址,入参和出参,headers信息都打印出来了

接下来试试异常情况,修改controller:

@PostMapping(value = “/hello”)
public SaySomeThing hello(@RequestBody SaySomeThing saySomeThing) {
throw new RuntimeException(“我是异常”);
// return saySomeThing;
}
运行结果:

日志打印:

INFO: log base dir is: /Users/xingcheng/logs/csp/
INFO: log name use pid is: false
2019-01-19 20:40:18.049 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] —> POST http://localhost:11111/feign/hello HTTP/1.1
2019-01-19 20:40:18.049 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] Content-Type: application/json;charset=UTF-8
2019-01-19 20:40:18.049 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] Content-Length: 36
2019-01-19 20:40:18.049 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing]
2019-01-19 20:40:18.049 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] {“name”:“chinotan”,“words”:“世界”}
2019-01-19 20:40:18.049 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] —> END HTTP (36-byte body)
2019-01-19 20:40:18.083 ERROR 3137 — [io-11111-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: 我是异常] with root cause

java.lang.RuntimeException: 我是异常
at cn.chinotan.controller.FeignController.hello(FeignController.java:26) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_162]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_162]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_162]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_162]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851) ~[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:158) ~[spring-boot-actuator-2.0.3.RELEASE.jar:2.0.3.RELEASE]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:126) ~[spring-boot-actuator-2.0.3.RELEASE.jar:2.0.3.RELEASE]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:111) ~[spring-boot-actuator-2.0.3.RELEASE.jar:2.0.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90) ~[spring-boot-actuator-2.0.3.RELEASE.jar:2.0.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:320)[spring−security−web−5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)[spring−security−web−5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)[spring−security−web−5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:320) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:320)[springsecurityweb5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)[springsecurityweb5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)[springsecurityweb5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334)[spring−security−web−5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)[spring−security−web−5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334)[springsecurityweb5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)[springsecurityweb5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334)[spring−security−web−5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)[spring−security−web−5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334)[springsecurityweb5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)[springsecurityweb5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334)[spring−security−web−5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158)[spring−security−web−5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[spring−web−5.0.7.RELEASE.jar:5.0.7.RELEASE]atorg.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334)[springsecurityweb5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158)[springsecurityweb5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[springweb5.0.7.RELEASE.jar:5.0.7.RELEASE]atorg.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334)[spring−security−web−5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)[spring−security−web−5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[spring−web−5.0.7.RELEASE.jar:5.0.7.RELEASE]atorg.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334)[springsecurityweb5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)[springsecurityweb5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[springweb5.0.7.RELEASE.jar:5.0.7.RELEASE]atorg.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334)[spring−security−web−5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)[spring−security−web−5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[spring−web−5.0.7.RELEASE.jar:5.0.7.RELEASE]atorg.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334)[springsecurityweb5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)[springsecurityweb5.0.6.RELEASE.jar:5.0.6.RELEASE]atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[springweb5.0.7.RELEASE.jar:5.0.7.RELEASE]atorg.springframework.security.web.FilterChainProxyVirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) ~[spring-security-web-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at com.alibaba.csp.sentinel.adapter.servlet.CommonFilter.doFilter(CommonFilter.java:89) ~[sentinel-web-servlet-1.4.0.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) ~[tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.coyote.AbstractProtocolConnectionHandler.process(AbstractProtocol.java:790)[tomcat−embed−core−8.5.31.jar:8.5.31]atorg.apache.tomcat.util.net.NioEndpointConnectionHandler.process(AbstractProtocol.java:790) [tomcat-embed-core-8.5.31.jar:8.5.31] at org.apache.tomcat.util.net.NioEndpointConnectionHandler.process(AbstractProtocol.java:790)[tomcatembedcore8.5.31.jar:8.5.31]atorg.apache.tomcat.util.net.NioEndpointSocketProcessor.doRun(NioEndpoint.java:1468) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.31.jar:8.5.31]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_162]
at java.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:624)[na:1.8.0162]atorg.apache.tomcat.util.threads.TaskThreadWorker.run(ThreadPoolExecutor.java:624) [na:1.8.0_162] at org.apache.tomcat.util.threads.TaskThreadWorker.run(ThreadPoolExecutor.java:624)[na:1.8.0162]atorg.apache.tomcat.util.threads.TaskThreadWrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.31.jar:8.5.31]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]

2019-01-19 20:40:18.112 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] <— HTTP/1.1 500 (62ms)
2019-01-19 20:40:18.113 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] cache-control: no-cache, no-store, max-age=0, must-revalidate
2019-01-19 20:40:18.113 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] connection: close
2019-01-19 20:40:18.113 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] content-type: application/json;charset=UTF-8
2019-01-19 20:40:18.113 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] date: Sat, 19 Jan 2019 12:40:18 GMT
2019-01-19 20:40:18.113 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] expires: 0
2019-01-19 20:40:18.113 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] pragma: no-cache
2019-01-19 20:40:18.113 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] transfer-encoding: chunked
2019-01-19 20:40:18.113 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] x-content-type-options: nosniff
2019-01-19 20:40:18.113 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] x-frame-options: DENY
2019-01-19 20:40:18.113 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] x-xss-protection: 1; mode=block
2019-01-19 20:40:18.113 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing]
2019-01-19 20:40:18.114 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] {“timestamp”:“2019-01-19T12:40:18.094+0000”,“status”:500,“error”:“Internal Server Error”,“message”:“我是异常”,“path”:"/feign/hello"}
2019-01-19 20:40:18.114 DEBUG 3137 — [io-11111-exec-2] cn.chinotan.feign.SayService : [SayService#saySomeThing] <— END HTTP (136-byte body)
2019-01-19 20:40:18.116 ERROR 3137 — [io-11111-exec-2] cn.chinotan.config.feign.MyErrorDecoder : methodKey: SayService#saySomeThing(SaySomeThing), reason is HTTP/1.1 500
cache-control: no-cache, no-store, max-age=0, must-revalidate
connection: close
content-type: application/json;charset=UTF-8
date: Sat, 19 Jan 2019 12:40:18 GMT
expires: 0
pragma: no-cache
transfer-encoding: chunked
x-content-type-options: nosniff
x-frame-options: DENY
x-xss-protection: 1; mode=block

{“timestamp”:“2019-01-19T12:40:18.094+0000”,“status”:500,“error”:“Internal Server Error”,“message”:“我是异常”,“path”:"/feign/hello"}
2019-01-19 20:40:18.116 ERROR 3137 — [io-11111-exec-2] c.c.feign.fallback.SayServiceFallback : 调用失败
可见利用feign组件可以轻松的实现远程接口的调用,监控和日志,配合Sentinel可以轻松实现流量控制和降级等

 (adsbygoogle = window.adsbygoogle || []).push({});

spring cloud利用feign和sentinel进行内部或外部远程调用相关推荐

  1. 《深入理解 Spring Cloud 与微服务构建》第八章 声明式调用 Feign

    ·# <深入理解 Spring Cloud 与微服务构建>第八章 声明式调用 Feign 文章目录 一.Feign 简介 1.简介 2.工作原理 二.写一个 Feign 客户端 三.Fei ...

  2. Spring Cloud Alibba教程:Sentinel的使用

    点击上方"方志朋",选择"置顶公众号" 技术文章第一时间送达! 什么是Sentinel Sentinel,中文翻译为哨兵,是为微服务提供流量控制.熔断降级的功能 ...

  3. Spring Cloud (Eureka,Feign,Hystrix整合)

    Spring Cloud(Eureka,Feign,Hystrix整合) Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智能路由,微代 ...

  4. Spring Cloud(四):Spring Cloud Alibaba Feign Dubbo

    扩展点 RequestInterceptor#apply 扩展点 feign.Client#execute spring cloud dubbo 调用 RPC RPC 全称是 Remote Proce ...

  5. Spring Cloud Gateway 整合阿里 Sentinel网关限流实战!

    前一篇文章介绍了Spring Cloud Gateway的一些基础知识点,今天陈某就来唠一唠网关层面如何做限流? 文章目录如下: 网关如何限流? Spring Cloud Gateway本身自带的限流 ...

  6. Spring Cloud Gateway 整合阿里 Sentinel网关限流实战

    文章目录如下: 网关如何限流? Spring Cloud Gateway本身自带的限流实现,过滤器是RequestRateLimiterGatewayFilterFactory,不过这种上不了台面的就 ...

  7. 6.Spring Cloud Alibaba教程:Sentinel流量防卫兵的介绍与基本使用

    官网 https://sentinelguard.io/ 服务雪崩 微服务中各个服务之间通过http/rpc互相调用,假设其中1个服务因为网络或自身原因出现问题,调用这个服务就会出现线程堵塞,此时若有 ...

  8. 三、spring cloud alibaba学习(Sentinel)

    雪崩效应 也叫级联故障,基础服务故障导致上层服务故障,并不断放大的过程. 例如C-->B-->A,A挂了,B调用A超时,B的线程有限,满了以后导致B也挂了,逐渐导致C及后面的也挂了,就像滚 ...

  9. spring cloud+zookeeper+feign整合 简单实例(一)

    一.前言 各位热爱知识的小伙伴们大家好呀!很高兴大家能点开这个博客,这是我个人的第一篇博客,之后也会持续的更新java以及spring项目的相关代码,希望大家持续关注.如果对本篇博客有什么不懂的地方或 ...

最新文章

  1. 学习web前端你必须要了解的主流框架!
  2. http请求 get 与 post 区别
  3. Java虚拟机常量池和本地变量表、自己定义的数值自动装入常量池
  4. C#内存泄露与资源释放 经验总结
  5. mysql 8.0远程连接_安装mysql 8.0.17并配置远程访问的方法
  6. LeetCode: Maximum Subarray 解题报告
  7. tl r402路由器设置_记一次TP-LINK路由器问题排查
  8. 自定义QListWidget实现item被hover时改变图标样式(模仿网易云音乐选项列表)(方法二)
  9. FuelPHP 系列(三) ------ Model 模型
  10. HTTP协议格式详解(总结)
  11. GitHub上十大热门Python项目
  12. linux ntp时间立即同步命令_linux时间同步,ntpd、ntpdate 【转】
  13. Centos7快速搭建服务器加速
  14. 【实用】齐齐哈尔市公交车线路站点汇总
  15. 河南灵活用工系统开发|灵活用工平台能为企业带来什么?
  16. 7.2.2我们天赋与经验的局限2
  17. RabbitMQ消息监听(多种模式-fanout/topic)
  18. 二.android 12 修改文件夹背景透明度
  19. idea配置maven(详细)
  20. 科研工具流1——Zotero管理文献

热门文章

  1. crc错误 modbus poll_干货丨从Modbus开始说现场总线!
  2. python怎么发布pycharm_如何使用PyCharm将代码上传到GitHub上(图文详解)
  3. 动词ing基本用法_哪些动词后面只能接动名词背诵口诀
  4. Leetcode每日一题:860.lemonade-change(柠檬水找零)
  5. C++中应用于for循环的auto机制,有引用和非引用两种操作
  6. Android Handler消息机制源码分析
  7. 设计模式快速学习(五)原型模式
  8. 聊天机器人最难理解的 10 个词汇
  9. transformer模型_【预训练模型】万字长文梳理NLP预训练模型!从transformer到albert...
  10. java 线程_理解java多线程