Spring Java framework
K. V. Raghavan
Indian Institute of Science, Bangalore
HTTP
What is Spring?
Selected Spring annotations
Selected Spring annotations - II
@GetMapping("/api/employees/{id}")
public String getEmployeesById(@PathVariable String id) {
return "ID: " + id;
}
@PostMapping("/request")
public ResponseEntity postController(@RequestBody LoginForm loginForm) {
exampleService.fakeAuthenticate(loginForm);
return ResponseEntity.ok(HttpStatus.OK);
}
The payload of the POST request (which has to be JSON format) automatically gets deserialized into the parameter object loginForm