Performance: @RequestParam for query strings
This affects server request handling speed and response time by how query parameters are parsed and bound.
public ResponseEntity<String> getData(@RequestParam("id") String id, @RequestParam("count") int count) { // process typed params directly return ResponseEntity.ok("Processed"); }
public ResponseEntity<String> getData(@RequestParam Map<String, String> params) {
// process params dynamically
return ResponseEntity.ok("Processed");
}| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Using Map<String, String> for @RequestParam | N/A | N/A | N/A | [X] Bad |
| Using explicit typed parameters with @RequestParam | N/A | N/A | N/A | [OK] Good |
@RequestParam annotation do in a Spring Boot controller?@RequestParam?@GetMapping("/greet")
public String greet(@RequestParam String name) {
return "Hello, " + name + "!";
}/greet?name=Anna?@GetMapping("/search")
public String search(@RequestParam int page) {
return "Page: " + page;
}/search is accessed without any query parameters?sort with default value "asc" and a required parameter page. Which method signature is correct?Pass the test and this pattern moves unknown