@requestbody in webservice java?

0 votes
52 views
asked May 15 in JAVA by anonymous
HI  

  Why we need the @requestbody in jave webservice and also provide the template code?

1 Answer

0 votes
answered May 15 by admin (8,115 points)

Hi  

    The @RequestBody method parameter annotation should bind the json value in the HTTP request body to the java object by using a HttpMessageConverter

@RequestMapping(value = "/", method = RequestMethod.POST)
public ResponseEntity<Car> update(@RequestBody Car car) {
    ...
}
...