@Controller
Learn @Controller (Controllers, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Fresher Notes @Controller is a stereotype annotation (a @Component ) that marks a class as a Spring MVC web controller found by component scanning. Return value : a String is a logical view name, and a Model carries data to the view. Mapping methods use @GetMapping , @PostMapping and similar, optionally under a class-level @RequestMapping .
More lessons in Controllers
- @RestController
- Controller Lifecycle
- Controller Methods
- Request Mapping
- @RequestMapping
- @GetMapping
- @PostMapping
- @PutMapping
- @DeleteMapping
- @PatchMapping
- Mapping HTTP Methods
- Mapping URL Paths
- Class-Level Mapping
- Method-Level Mapping
- Multiple URL Mappings
- Consumes
- Produces
- Mini Project: Controller Types and Mapping Rules