Do I need to serialize objects to use @RequestBody @ResponseBody annotations

Is the class passed as a parameter in the controller method and marked with the annotation @RequestBodyneeded to implement the interface Serializable?

I have the same question for a return value class marked with annotation @ResponseBody.

I will also be very grateful for an explanation of why the interface Serializableis or is not required.

+4
source share
1 answer

. , @ResponseBody, , JSON, . Java, Serializable.

@RequestBody @ResponseBody RequestResponseBodyMethodProcessor, HttpMessageConverter , , JSON JSON .

HttpMessageConverter, canRead, : boolean canRead(Class<?> clazz, MediaType mediaType); , , .

+4

All Articles