Performance: @PostMapping for POST requests
MEDIUM IMPACT
This affects server response time and client perceived loading speed when handling POST requests.
@PostMapping("/submit") public CompletableFuture<ResponseEntity<String>> submitData(@RequestBody Data data) { return CompletableFuture.supplyAsync(() -> { processData(data); // async processing return ResponseEntity.ok("Success"); }); }
@PostMapping("/submit") public ResponseEntity<String> submitData(@RequestBody Data data) { // heavy synchronous processing processData(data); // long blocking operation return ResponseEntity.ok("Success"); }
| Pattern | Server Thread Usage | Response Delay | Client Impact | Verdict |
|---|---|---|---|---|
| Synchronous blocking in @PostMapping | High (blocks thread) | High (long delay) | Slow page load (LCP affected) | [X] Bad |
| Asynchronous processing in @PostMapping | Low (non-blocking) | Low (fast response) | Faster page load (better LCP) | [OK] Good |