[ERROR] [http-nio-8090-exec-8] [DirectJDKLog.java:175] - Servlet.service() for servlet [dispatcherServlet] in context with path [/xxx-backend] threw exception [Request processing failed; nested exception is feign.FeignException$BadRequest: [400] during [POST] to [http://serviece-xxx/xxx/listByPertients?personals=......] [xxxxxxClient#listByPertients(List)]: [<!doctype html><html lang="en"><head><title>HTTP Status 400 – Bad Request</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;... (435 bytes)]] with root cause
接口报错,通过调试发现接口穿list接口太长
@PostMapping("xxxxSet/listByPertients")
List<xxxDto> listByPertients(@RequestParam List<String> personals);
接口改为下面可以,最好限制list长度,或者分批次查询
@PostMapping("xxxxSet/listByPertients")
List<xxxDto> listByPertients(@RequestBody List<String> personals);
原因:@RequestParam会经过Query String的方式,即便设置了提交方式是post也会将参数拼接在url的后面,然而url传参是有长度限制的(类似于Get请求),会截断后面的参数,致使请求失败 ;而RequestBody长度不会限制