Skip to main content

@PostMapping

Learn @PostMapping (Controllers, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Fresher Notes @PostMapping maps HTTP POST requests to a method; it is the shortcut for @RequestMapping(method = RequestMethod.POST) and is used to create resources or submit forms. Body : send JSON and read it with @RequestBody ; for HTML forms Spring binds fields with @ModelAttribute or @RequestParam . Response : a create usually returns 201 Created with a Location header.

More lessons in Controllers