Feign 简介与使用入门,请求、响应压缩,日志记录

目录

Feign 声明式web服务客户端

feign 声明式web客户端使用

eurekaserver_changsha(注册中心)

eureka-client-food(服务提供者)

feign-client-cat(服务消费者)

浏览器访问微服务调用测试

Feign 请求与响应压缩 与 日志


Feign 声明式web服务客户端

spring-cloud-openfeign 官网:https://spring.io/projects/spring-cloud-openfeign

spring cloud 官方 2.1.x 文档:https://cloud.spring.io/spring-cloud-openfeign/2.1.x/single/spring-cloud-openfeign.html

feign Github 开源地址:https://github.com/OpenFeign/feign

1、feign 是一个声明式 Web 服务客户端/http 客户端,它使编写 Web 服务客户端更加容易,要使用 feign,请创建一个接口并对其进行注释。它具有可插拔的注解支持,包括外部注解和 JAX-RS 注解。Feign 还支持可插拔的编码器和解码器。

2、Spring Cloud 增加了对 Spring MVC 注解的支持,并支持使用 Spring Web 中默认使用的 HttpMessageConverters,Spring Cloud 集成了 Ribbon 和 Eureka,在使用 Feign 时提供一个负载均衡的 http 客户端。

3、虽然直接使用 org.springframework.web.client.RestTemplate 也可以实现微服务之间的 http 调用,但是 feign 作为一个独立的库,更具有优势,它使得调用远程微服务的 API 就如同调用自己本地的 API 一样。

4、How to Include Feign?按着官网文档介绍,使用 feign 很简单,分为如下几步:

1)服务请求/调用/消费方在 pom.xml 文件中导入 feign 依赖:

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-openfeign</artifactId>
    </dependency>

2)服务请求/调用/消费方在启动类上加上 @org.springframework.cloud.openfeign.EnableFeignClients 注解开启 feignClient 客户端:

@SpringBootApplication
@EnableFeignClients
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

3)服务请求/调用/消费方创建一个接口,@FeignClient 表示此接口为 feign 客户端,"stores" 为服务提供者的微服务名称,可以从注册中心看到,接口中的方法就是服务提供者 Cotroller 层的方法。

其中 @RequestMapping 请求方式必须与服务提供者提供的方式一致,value 是请求路径,如果对方设置了应用上下文,则 value 中也要加上,方法名称可以自定义,不过建议与服务提供者一致。

@FeignClient("stores")
public interface StoreClient {
    @RequestMapping(method = RequestMethod.GET, value = "/stores")
    List<Store> getStores();

    @RequestMapping(method = RequestMethod.POST, value = "/stores/{storeId}", consumes = "application/json")
    Store update(@PathVariable("storeId") Long storeId, Store store);
}

4)然后服务请求/调用/消费方可以在自己的 Controller 中调用上面接口中的方法,表面上好像调用自己的 API,实际上会通过微服务名称和路径调用远程微服务接口。

官网文档:https://cloud.spring.io/spring-cloud-openfeign/2.1.x/single/spring-cloud-openfeign.html#netflix-feign-starter

feign 声明式web客户端使用

1、使用非常简单,开发环境为:Java JDK 1.8 + Spring Boot 2.1.3 + Spring Cloud Greenwich.SR1 + IDEA 2018。

2、准备三个微服务应用:eurekaserver_changsha 应用作 eureka 服务端,用于服务注册;eureka-client-food 应用提供服务;feign-client-cat 应用作为服务请求者,请求 eureka-client-food 提供的服务(接口)

3、操作流程:用户从浏览器访问 feign-client-cat 、feign-client-cat 应用内部调用 eureka-client-food 微服务,然后返回数据。

eurekaserver_changsha(注册中心)

1、pom.xml 文件核心内容如下(详细源码地址:https://github.com/wangmaoxiong/feign_first):

...
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.3.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
...
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>

2、全局配置文件内容如下(详细源码地址:https://github.com/wangmaoxiong/feign_first):

server:
  port: 9393
eureka:
  server:
    enable-self-preservation: false #关闭自我保护机制
    eviction-interval-timer-in-ms: 60000 #驱逐计时器扫描失效服务间隔时间。(单位毫秒,默认 60*1000)
  instance:
    hostname: localhost
  client:
    register-with-eureka: false   #禁用自己向自己注册
    fetch-registry: false   #不同步其他的 Eureka Server节点的数据
    service-url:  #Eureka Client 与 Eureka Server 交互的地址
      default-zone: http://${eureka.instance.hostname}:${server.port}/eureka/

3、启动类上添加 @EnableEurekaServer:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

/**
 * @EnableEurekaServer:开启 eureka 服务
 */
@SpringBootApplication
@EnableEurekaServer
public class EurekaserverChangshaApplication {
    public static void main(String[] args) {
        SpringApplication.run(EurekaserverChangshaApplication.class, args);
    }
}

注册中心提供服务注册,内容不多。

eureka-client-food(服务提供者)

1、pom.xml 文件核心内容如下(详细源码地址:https://github.com/wangmaoxiong/feign_first):

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.3.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
...
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
...

2、全局配置文件内容如下(详细源码地址:https://github.com/wangmaoxiong/feign_first):

server:
  port: 9395  #服务器端口
  servlet:
    context-path: /food   #应用访问上下文
spring:
  application:
    name: eureka-client-food  #微服务名称
eureka:
  client:
    service-url:
      defaultZone: http://localhost:9393/eureka/ #eureka 服务器地址
  instance:
    prefer-ip-address: true # IP 地址代替主机名注册
    instance-id: changSha-food # 微服务实例id名称

3、服务提供者提供的服务就是 http 访问的接口,所以创建一个 Controller 层,提供访问接口,其中提供了不同参数的访问方式,以达到基本满足日常开发的需要:

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import wmx.com.eurekaclient_food.pojo.Person;

import java.io.IOException;
import java.time.LocalDateTime;
/**
 * 菜谱
 *
 * @author wangmaoxiong
 */
@RestController
public class Cuisine {
    private static final Logger logger = LoggerFactory.getLogger(Cuisine.class);
    /**
     * 获取湘菜菜谱数据。访问地址:http://localhost:9395/food/getHunanCuisine?uuid=98389uou8309adko990
     *
     * @return
     */
    @GetMapping("getHunanCuisine")
    public String getHunanCuisine(String uuid) {
        logger.info("获取湖南菜谱,uuid = {}", uuid);
        JsonNodeFactory nodeFactory = JsonNodeFactory.instance;//以 json 格式返回
        ArrayNode arrayNode = nodeFactory.arrayNode()
                .add("辣椒炒肉")
                .add("剁椒鱼头")
                .add("蚂蚁上树")
                .add(StringUtils.trimToNull(uuid));
        return arrayNode.toString();
    }
    /**
     * 根据 id 删除:http://localhost:9395/food/deleteDataById?id=980890
     *
     * @param id
     * @return
     */
    @GetMapping("deleteDataById")
    public String deleteDataById(@RequestParam(value = "id") Integer id) {
        logger.info("根据 id 删除,id = {}", id);
        JsonNodeFactory nodeFactory = JsonNodeFactory.instance;
        ObjectNode objectNode = nodeFactory.objectNode();//以 json 格式返回
        objectNode.put("id", id);
        objectNode.put("code", 200);
        objectNode.put("message", "delete success");
        return objectNode.toString();
    }
    /**
     * 更新:http://localhost:9395/food/updateData/889uuo65eud99?data=name_zhangsan,age_33
     *
     * @param uid  :使用路径变量
     * @param data :使用普通的请求参数
     * @return
     */
    @RequestMapping(value = "updateData/{uid}", method = RequestMethod.GET)
    public String updateData(@PathVariable("uid") String uid, String data) {
        logger.info("更新数据,uid = {}, data = {}", uid, data);
        JsonNodeFactory nodeFactory = JsonNodeFactory.instance;
        ObjectNode objectNode = nodeFactory.objectNode(); //以 json 格式返回
        objectNode.put("code", 200);
        objectNode.put("message", "更新成功");
        objectNode.put("uid", uid);
        objectNode.put("data", data);
        return objectNode.toString();
    }
    /**
     * 保存数据:http://localhost:9395/food/saveData?type=saveing
     *
     * @param jsonData :使用请求正文(json 格式)传入,数据在请求体中,如:{"id":9527,"name":"华安","order":100000},页面必须传入
     * @param type     :使用普通的 key-value 格式传入,数据在请求透中
     * @return
     */
    @PostMapping("saveData")
    public String saveData(@RequestBody String jsonData, @RequestParam String type) {
        logger.info("保存数据,jsonData = {}, type = {}", jsonData, type);
        JsonNodeFactory nodeFactory = JsonNodeFactory.instance;
        ObjectNode objectNode = nodeFactory.objectNode();//以 json 格式返回
        try {
            objectNode.put("code", 200);
            objectNode.put("message", "保存成功");
            objectNode.put("type", type);

            ObjectMapper objectMapper = new ObjectMapper();
            JsonNode jsonNode = objectMapper.readTree(jsonData);
            objectNode.set("jsonDta", jsonNode);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return objectNode.toString();
    }
    /**
     * 测试 get 方式复杂对象调用:http://localhost:9395/food/updatePerson?pid=100&pname=张三&age=33
     *
     * @param person
     * @return
     */
    @GetMapping("updatePerson")
    public Person updatePerson(Person person) {
        logger.info("更新数据 person = {}", person);
        person.setBirthday(LocalDateTime.now());
        return person;
    }
    /**
     * 测试 post 方式复杂对象调用:http://localhost:9395/food/updatePerson2?pid=100&pname=张三&age=33
     * 1、对于复杂对象,不建议使用 @RequestBody 在请求体中传递数据,因为 feignClient 客户端调用时会很难处理
     * 2、如果非得要使用 @RequestBody ,则建议使用 String 类型,而不是复杂对象
     * 3、也可以如下所示,使用请求头传递参数,这样 feignClient 客户端可以将复杂对象拆成属性调用
     *
     * @param person
     * @return
     */
    @PostMapping("updatePerson2")
    public Person updatePerson2(Person person) {
        logger.info("更新数据(post) person = {}", person);
        person.setBirthday(LocalDateTime.now());
        return person;
    }
}

feign-client-cat(服务消费者)

1、pom.xml 文件核心内容如下(详细源码地址:https://github.com/wangmaoxiong/feign_first):

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.3.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
...
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
...

2、全局配置文件内容如下(详细源码地址:https://github.com/wangmaoxiong/feign_first):

server:
  port: 9394    #服务器端口
  servlet:
    context-path: /cat  #应用访问上下文
spring:
  application:
    name: feign-client-cat  #微服务名称
eureka:
  client:
    service-url:
      defaultZone: http://localhost:9393/eureka/ #eureka 服务器地址
  instance:
    prefer-ip-address: true # IP 地址代替主机名注册
    instance-id: feign-cat # 微服务实例id名称

feign:
  name:
    food: eureka-client-food #服务提供方的服务名称,自定义配置。

3、启动类代码如下:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
 * @EnableFeignClients:开启 feign 客户端
 * @EnableEurekaClient:开启 eureka 客户端,可以不写,默认就是开启的
 */
@SpringBootApplication
@EnableFeignClients
@EnableEurekaClient
public class FeignClientCatApplication {
    public static void main(String[] args) {
        SpringApplication.run(FeignClientCatApplication.class, args);
    }
}

4、提供 feign 客户端接口如下:

1)@FeignClient 注解的 vaule 和 name 其实是一个属性,互相使用了别名,完全等价。值为服务提供方的服务名称。

2)@FeignClient(name = "${feign.name.food}"):推荐方式,服务提供方的服务名称从配置文件读取。

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import wmx.com.feign_client_cat.pojo.Person;

import java.time.LocalDateTime;
/**
 * 1、@FeignClient :声明接口为 feign 客户端,value 值为被请求的微服务名称(注册中心可以看到,配置文件中的spring.application.name属性值),
 * value 可以省略如 @FeignClient("eureka-client-food")。推荐方式:@FeignClient(name = "${feign.name.food}")
 * 2、@FeignClient 接口中的方法名称可以自定义,但建议保持与对方一致,请求方式必须一致,请求路径记得带上服务提供方上下文路径(如果有的话)
 * 有些细节需要注意,下面注释中有说明
 */
@FeignClient(value = "eureka-client-food")
public interface FoodFeignClient {
    /**
     * 获取湘菜菜谱数据
     * 1、"food" 是被请求应用的上下文件路径,一并写在方法上
     * 2、@GetMapping 也可以拆开写成:@RequestMapping(value = "food/getHunanCuisine", method = RequestMethod.GET)
     * 3、参数为字符串时,如果没加 @RequestParam("uuid") 请求参数注解,则请求时会抛异常如下:
     * feign.FeignException: status 405/404 reading FoodFeignClient#getHunanCuisine(String)
     * 4、低版本的 feignClient 方法中不支持 @GetMapping 注解,必须用 @RequestMapping,高版本开始支持 @GetMapping
     *
     * @return
     * @GetMapping("getHunanCuisine")
     */
    @GetMapping("food/getHunanCuisine")
    public String getHunanCuisine(@RequestParam("uuid") String uuid);
    /**
     * 根据 id 删除
     * 1、@RequestMapping 也可以换成 @GetMapping("food/deleteDataById")
     * 2、经过实测参数为整形时,@RequestParam("id") 此时可加可不加,但都建议加上
     * @param id
     * @return
     */
    @RequestMapping(value = "food/deleteDataById", method = RequestMethod.GET)
    public String deleteDataById(@RequestParam("id") Integer id);
    /**
     * 更新
     * 1、高版本的 feignClient 中的 @PathVariable("uid") 注解可以不写 value 属性,如 @PathVariable,低版本则必须写
     * 2、再次提醒:对于 String 参数,服务提供者方法上有没有加 @RequestParam,feignClient 客户端都需要加上,否则调用失败,抛异常:
     * feign.FeignException: status 405 reading FoodFeignClient#updateData(String,String)
     * @param uid  :使用路径变量
     * @param data :使用普通的请求参数
     * @return
     */
    @GetMapping(value = "food/updateData/{uid}")
    public String updateData(@PathVariable("uid") String uid, @RequestParam String data);
    /**
     * 保存数据,post 请求。再次提醒 food 是服务提供者应用上下文件路径
     * @return
     */
    @PostMapping("food/saveData")
    public String saveData(@RequestBody String jsonData, @RequestParam String type);
    /**
     * 测试复杂对象调用
     * 1、对于 get 请求,参数为复杂对象时,feignClient 中如果直接使用 public Person updatePerson(Person person); 会抛异常:
     * feign.FeignException: status 404 reading FoodFeignClient#updatePerson(Person)
     * 2、抛异常的原因是对于get方式复杂对象传递时,虽然已经指明了是 get 方式,但是 feign 还是会以 post 方式传递,导致调用失败
     * 3、解决方式1:可以和服务提供者协商,转换成 String 的方式进行传递;解决方式2:将复杂对象(Pojo) 拆成简单的属性,如下所示
     * @return
     */
    @GetMapping("food/updatePerson")
    public Person updatePerson(@RequestParam Integer pid,
                               @RequestParam String pname,
                               @RequestParam Integer age,
                               @RequestParam LocalDateTime birthday);
    /**
     * 测试 post 方式复杂对象调用
     * 1、与 get 方式差不多,当服务提供者使用 updatePerson2(Person person) 时,feign 客户端不能这么直接传递
     * 虽然 post 方式这样直传不会报错,但是对方接收不到数据,所以仍然只能拆成简单的属性进行传递
     * 2、如果对方要求的是 @RequestBody ,则此时这样写会直接抛异常,推荐解决方式是使用 String 类型传递
     * @return
     */
    @PostMapping("food/updatePerson2")
    public Person updatePerson2(@RequestParam Integer pid,
                                @RequestParam String pname,
                                @RequestParam Integer age,
                                @RequestParam LocalDateTime birthday);
}

5、@FeignClient 客户端接口中的方法请求方式要求与服务提供者一致,然而服务消费者自己控制层的调用方式是不受约束的,可以自己随意设置,控制层调用代码如下:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import wmx.com.feign_client_cat.feignClient.FoodFeignClient;
import wmx.com.feign_client_cat.pojo.Person;

import javax.annotation.Resource;
@RestController
public class CatController {
    private static final Logger logger = LoggerFactory.getLogger(CatController.class);
    //注入 feign 客户端实例。有了 feign 之后,调用远程微服务就如同调用自己本地的方法一样简单
    //@FeignClient 客户端接口中的方法请求方式要求与服务提供者一致,然而服务消费者自己控制层的调用方式是不受约束的
    @Resource
    private FoodFeignClient foodFeignClient;
    /**
     * 查询湖南菜谱:http://localhost:9394/cat/getHunanCuisine?uuid=77884934euei000pp
     * @param uuid
     * @return
     */
    @GetMapping("getHunanCuisine")
    public String getHunanCuisine(String uuid) {
        logger.info("查询湖南菜谱,uuid = {}", uuid);
        String result = this.foodFeignClient.getHunanCuisine(uuid);
        return result;
    }
    /**
     * 根据 id 删除:http://localhost:9394/cat/deleteDataById?id=980890
     * @param id
     * @return
     */
    @GetMapping("deleteDataById")
    public String deleteDataById(@RequestParam(value = "id") Integer id) {
        logger.info("根据 id 删除,id = {}", id);
        String result = this.foodFeignClient.deleteDataById(id);
        return result;
    }
    /**
     * 更新:http://localhost:9394/cat/updateData/889uuo65eud99?data=name_zhangsan,age_33
     * @param uid  :使用路径变量
     * @param data :使用普通的请求参数
     * @return
     */
    @RequestMapping(value = "updateData/{uid}", method = RequestMethod.GET)
    public String updateData(@PathVariable("uid") String uid, String data) {
        logger.info("更新数据,uid = {}, data = {}", uid, data);
        String result = this.foodFeignClient.updateData(uid, data);
        return result;
    }
    /**
     * 保存数据:http://localhost:9394/cat/saveData?type=saveing
     * @param jsonData :使用请求正文(json 格式)传入,数据在请求体中,如:{"id":9527,"name":"华安","order":100011}
     * @param type     :使用普通的 key-value 格式传入,数据在请求透中
     * @return
     */
    @PostMapping("saveData")
    public String saveData(@RequestBody String jsonData, @RequestParam String type) {
        logger.info("保存数据,jsonData = {}, type = {}", jsonData, type);
        String result = this.foodFeignClient.saveData(jsonData, type);
        return result;
    }
    /**
     * 测试 get 方式复杂对象调用:http://localhost:9394/cat/updatePerson?pid=100&pname=张三&age=33
     * @param person
     * @return
     */
    @GetMapping("updatePerson")
    public Person updatePerson(Person person) {
        logger.info("updatePerson(get) person = {}", person);
        return this.foodFeignClient.updatePerson(person.getPid(),
                person.getPname(),
                person.getAge(),
                person.getBirthday());
    }
    /**
     * 测试 post 方式复杂对象调用:http://localhost:9394/cat/updatePerson2
     * 1、@RequestBody:表示参数通过请求体传递,且为 json 格式,所以前端必须设置请求类型:Content-Type: application/json
     * @param person :{"pid":9334,"pname":"华雄","age":35}
     * @return
     */
    public Person updatePerson2(@RequestBody Person person) {
        logger.info("updatePerson(post) person = {}", person);
        return this.foodFeignClient.updatePerson2(person.getPid(),
                person.getPname(),
                person.getAge(),
                person.getBirthday());
    }
}

详细源码地址:https://github.com/wangmaoxiong/feign_first

浏览器访问微服务调用测试

1、顺序启动 eureka 注册中心、服务提供者、服务消费者,然后从浏览器请求 feign-client-cat,如果它能从 eureka-client-food(服务提供者)获取数据并返回,则说明成功。

2、因为有 post 请求,所以在 firefox 浏览器上安装使用 https://addons.mozilla.org/zh-CN/firefox/addon/restclient/ 插件进行访问测试:

Feign 请求与响应压缩 与 日志

Feign 请求与响应压缩

1、Feign request/response compression:可以为 feign 请求或响应 使用 gzip 压缩,压缩设置与为 web 服务器的设置类似,允许选择压缩媒体类型和最小请求阈值长度。哪边使用 feign 就配置在哪边。

feign.compression.request.enabled=true      #开启 feign 请求压缩,默认 false
feign.compression.response.enabled=true     #开启 feign 响应压缩,默认 false
feign.compression.request.mime-types=text/xml,application/xml,application/json      #设置 feign 请求压缩类型
feign.compression.request.min-request-size=2048     #开启 feign 请求压缩阈值,超过此值才进行压缩,默认 2048

Feign 日志记录

1、Feign logging:Feign 日志默认是不开启的,可以通过配置进行开启,如下所示,logging.level 表示日志级别,后面跟着 feign 客户端接口的完整类名,或者它的包名,日志记录只响应 debug 级别,所以值只能是 debug。

logging:
  level:
    wmx.com.feign_client_cat.feignClient.FoodFeignClient: debug

2、上面的配置开启之后表示 feign 可以记录日志了,但是具体怎么记录,还需要在配置类(@Configuration)中进行指定记录级别:

NONE:无日志记录(默认)

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

HEADERS: 头,记录基本信息以及请求和响应头。

FULL: 完整,记录请求和响应的头、正文和元数据。

3、例下面将 logger.level 设置为 full 级别:

import feign.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SysConfig {
    @Bean
    Logger.Level feignLoggerLevel() {
        return Logger.Level.FULL;
    }
}

4、当再次访问 feign-client-cat 微服务,它内部调用 eureka-client-food 时,控制台打印日志记录如下:

2019-11-04 17:35:36.768 DEBUG 8912 --- [nio-9394-exec-1] w.c.f.feignClient.FoodFeignClient        : [FoodFeignClient#updateData] <--- HTTP/1.1 200 (268ms)
2019-11-04 17:35:36.768 DEBUG 8912 --- [nio-9394-exec-1] w.c.f.feignClient.FoodFeignClient        : [FoodFeignClient#updateData] content-length: 89
2019-11-04 17:35:36.768 DEBUG 8912 --- [nio-9394-exec-1] w.c.f.feignClient.FoodFeignClient        : [FoodFeignClient#updateData] content-type: text/plain;charset=UTF-8
2019-11-04 17:35:36.768 DEBUG 8912 --- [nio-9394-exec-1] w.c.f.feignClient.FoodFeignClient        : [FoodFeignClient#updateData] date: Mon, 04 Nov 2019 09:35:36 GMT
2019-11-04 17:35:36.768 DEBUG 8912 --- [nio-9394-exec-1] w.c.f.feignClient.FoodFeignClient        : [FoodFeignClient#updateData] 
2019-11-04 17:35:36.770 DEBUG 8912 --- [nio-9394-exec-1] w.c.f.feignClient.FoodFeignClient        : [FoodFeignClient#updateData] {"code":200,"message":"更新成功","uid":"889uuo65eud99","data":"name_zhangsan,age_33"}
2019-11-04 17:35:36.770 DEBUG 8912 --- [nio-9394-exec-1] w.c.f.feignClient.FoodFeignClient        : [FoodFeignClient#updateData] <--- END HTTP (89-byte body)
发布了458 篇原创文章 · 获赞 884 · 访问量 92万+

猜你喜欢

转载自blog.csdn.net/wangmx1993328/article/details/100186900