Feign client doesn’t encode request param correctly

Viewed 51

I have a feign client with the following structure

Result getResult(@RequestParam String id, @RequestParam Map<String, Object> params)

Where the value in the map in the second argument can be of any primitive type (int, long) or object (String, BigDecimal).

Unfortunately, the values in the client request don’t seem to be deserialized correctly on the server side. For instance, sending a Map.of(“userId”, 1234567893L) is parsed as “userId”->”1234567893L”, instead of “userId”->1234567893L. Is there a way to tell the objectmapper to parse Long values as expected?

1 Answers

Try using

@QueryMap Map<String, Object> 

params instead of

@RequestParam Map<String, Object> params)
Related