Feign调用请求数据过大和响应时间过长的处理办法

请求过大

在使用 Feign 进行服务间调用时,Spring 默认配置了将服务间传输的 JSON 数据进行压缩。当传输数据的大小超过一定值时(具体我也没查到底是多大),就会报如下错误:

Caused by: com.fasterxml.jackson.core.JsonParseException: Illegal character ((CTRL-CHAR, code 31)): 
only regular white space (\r, \n, \t) is allowed between tokens at [Source: (PushbackInputStream); line: 1, column: 2]

这时需要更改 Feign 配置:

feign:
  compression:
    request:
      enabled: false
    response:
      enabled: false

 

posted @ 2022-11-30 15:02  浅笑19  阅读(1387)  评论(0)    收藏  举报