Hi,
I am making the following post request :
http://localhost:8080/api/users/create
with postman and body :
{ "userName" : "rohit", "email" : "rohit@xyz.com" }
In my controller i have :
@RequestMapping(value = "/api/users/create", method = RequestMethod.POST)
@ResponseBody
public APIPOSTResponse userAdd(@RequestBody User user)
And this perfectly converts json to the User object.
I read in docs that spring using a HttpMessageConverters for this.
When i navigated from intellij to MessageConverter interface i saw many classes implementing it.
They were all in
spring-web jar.
I found one implementation which i suspected :
MappingJackson2HttpMessageConverter will do the conversion and put break points in the decompiled source code the debugger didnt stop. Although it did stop
in the class
AbstractHttpMessageConverter.
My understanding is based on the
mediaType proper converter will be invoked. Want to confirm if this is correct with experts. Also what converter is executed for mediaType application/json ?
Thanks