Performance: @RestController annotation
MEDIUM IMPACT
This affects server response time and client perceived load speed by simplifying REST API endpoint creation.
@RestController public class MyController { @RequestMapping("/data") public String getData() { return "Hello"; } }
@Controller public class MyController { @RequestMapping("/data") @ResponseBody public String getData() { return "Hello"; } }
| Pattern | Server Processing | Annotation Overhead | Response Consistency | Verdict |
|---|---|---|---|---|
| @Controller + @ResponseBody | Moderate | Higher due to multiple annotations | Consistent if used correctly | [!] OK |
| @RestController | Lower | Minimal, combined annotation | Always consistent JSON/text response | [OK] Good |