i need to post data to a rest api through form data. the values are long values. i have written the below code, its giving the error.
MultiValueMap<String, Object> formData = new LinkedMultiValueMap<>();
formData.add("commentId", Long.valueOf(98578976));
formData.add("reactionID", Long.valueOf(609878777));
webClient
.post()
.uri(url)
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.header("authorization", accessToken)
.syncBody(formData)
.retrieve()
.bodyToMono(SocialFeed.class)
.block();
Error:java.lang.ClassCastException: class java.lang.Long cannot be cast to class java.lang.String (java.lang.Long and java.lang.String are in module java.base of loader 'bootstrap').
generally its excepting multi value map of string, string . how to post other types of data ? key is String, value is long ?