0
I was taking a look at the requisitions from Spring Boot
and I saw that you can make a requisition POST
, in two ways:
//primeira forma
@RequestMapping(value = "/dev", method = RequestMethod.POST)
public ResponseEntity<String> dev(@RequestParam("nome") String nome) {
return new ResponseEntity<String>(nome, HttpStatus.OK);
}
//segunda forma
@PostMapping("/dev")
public ResponseEntity<String> nome(@RequestParam("nome") String nome) {
return new ResponseEntity<String>(nome, HttpStatus.OK);
}
I tested with the Postman
and both return the same result.
What’s the difference in these two ways?
Is there any limitation in either?
What is the most appropriate, when will send data from a form, by example?