Spring MVC
Spring's framework for web applications and APIs, which routes each HTTP request to a controller method and turns its return value into a response.
In more detail
MVC stands for model-view-controller, a pattern that separates data, presentation and request handling. In a JSON API the view is simply the serialized response body. Filters, validation and controller advice all take part in the request's journey through Spring MVC.
Related terms
- controller (Spring) — A Spring class, usually marked @RestController, whose methods handle HTTP requests for particular paths and return response bodies.
- request mapping — The annotations, such as @GetMapping("/orders/{id}"), that connect an HTTP method and path to a controller method.
- MockMvc — Spring's test tool that sends requests through the full Spring MVC machinery to your controllers without opening a real network port.
- controller advice — A Spring class, marked @RestControllerAdvice, whose exception handlers apply across all controllers, giving one failure policy for every route.
Taught in
- Controllers And Routing — Modern Java: Virtual Threads & High-Throughput Services
- Testing APIs With MockMvc — Modern Java: Virtual Threads & High-Throughput Services