Skip to main content

@RestController

Learn @RestController (REST API with Spring MVC, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Fresher Notes @RestController is a stereotype annotation equal to @Controller plus @ResponseBody on every method. Effect : return values are written to the HTTP response body through message converters, never resolved as a view name. Component scanning registers it as a bean, so it also works with constructor injection.

More lessons in REST API with Spring MVC