Code Room
Code reviewMedium
Question
Review this Java Spring REST controller.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
@PostMapping("/orders")public ResponseEntity<?> create(@RequestBody OrderDto dto) { if (dto.getItems().isEmpty()) { return ResponseEntity.badRequest().body("items required"); } try { Order o = orderService.place(dto); return ResponseEntity.ok(o); } catch (Exception e) { return ResponseEntity.status(500) .body(e.getMessage()); }}Run or narrate your approach, then ask the coach.