Skip to main content
PProfileMatch
← Path

Spring Boot · Spring Boot REST Controllers, DTOs and Validation

0 XP
  1. 1 current stop: learning
  2. 2 upcoming
  3. 3 upcoming
  4. 4 upcoming
  5. 5 upcoming

Finish after stop 5

Stop 1 of 5 · Booking desk at the clinic

Trick to keep in mind+3 XP

@RestController = @Controller + @ResponseBody: the return value is the reply.

A plain controller returns a view name to be rendered. Adding @ResponseBody makes the returned object itself the HTTP body, and Jackson turns it into JSON by default. The annotation does not create routes or open a transaction; you still need @GetMapping and friends on each method.

Read it once, then a question tests whether the trick stuck.