DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk3 min

Spring Boot Under the Hood, Part 7: From Embedded Tomcat to Your @RestController

Tomcat receives servlet requests; Spring MVC’s DispatcherServlet routes matching requests to controller methods and converts their return values into responses.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In a standard Spring Boot servlet application, Tomcat accepts the HTTP request, registered servlet filters run, and Spring MVC’s DispatcherServlet delegates it to a matching controller method. The method’s return value then becomes part of the HTTP response, often through a message converter. Tomcat handles the servlet-container layer; Spring MVC handles the controller dispatch.

The two layers: embedded Tomcat and Spring MVC

Spring Boot configures and starts an embedded servlet server for a servlet-based application. Tomcat is one supported choice; Jetty and Undertow are alternatives. In the Spring Boot 3.3 reference, the default embedded server port is 8080. The application context obtains a ServletWebServerFactory, whose implementation creates the selected server. Spring Boot 3.3: Servlet Web Applications

As an Amazon Associate I earn from qualifying purchases.

Tomcat is not the component that understands @RestController. It provides the servlet container that receives and dispatches servlet requests. Spring MVC supplies the DispatcherServlet and the machinery that matches requests to application handlers.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How a request reaches a controller

For the ordinary Spring MVC path, the sequence is:

HTTP client → embedded Tomcat connector → servlet filters → DispatcherServlet → handler mapping and adapter → @RestController method → HttpMessageConverter → HTTP response

This is a conceptual request flow, not a description of Tomcat’s internal socket, protocol, or thread implementation. Each stage has a distinct responsibility.

1. Tomcat receives the request and filters run

The servlet container receives the HTTP request and applies registered servlet filters before dispatching to the servlet mapped for the URL. Spring Boot can register servlet and filter beans with the embedded container. In the standard arrangement, a single servlet maps to / and filters map to /*; additional registrations, URL patterns, or ordering choices can change which requests pass through which filters. Spring Boot 3.3: Servlet registration

Filters operate at the servlet-container boundary. They can affect a request before it reaches Spring MVC, but they do not select a Spring controller method.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. DispatcherServlet takes the front-controller role

In Spring MVC, the servlet handling the application’s MVC requests is normally DispatcherServlet. The Spring Framework describes the front-controller pattern this way: “Spring MVC, as many other web frameworks, is designed around the front controller pattern where a central Servlet, the DispatcherServlet, provides a shared algorithm for request processing, while actual work is performed by configurable delegate components.” Spring Framework Reference: DispatcherServlet

In other words, the dispatcher coordinates request processing; it is not the container and does not contain every routing rule itself.

3. Spring MVC matches the request to a handler

Spring MVC’s handler-mapping components compare request details with registered mappings. In annotation-driven controllers, those mappings are declared with @RequestMapping and composed annotations such as @GetMapping. If a mapping matches, an MVC handler adapter invokes the selected method and Spring MVC resolves its parameters. Tomcat does not inspect these annotations or choose the method. Spring Boot 3.3: Spring MVC

Path matching is configurable and version-sensitive. Spring Boot 3.3 documents PathPatternParser as the default strategy and describes its customization and restrictions; do not assume every pattern behaves identically across Boot releases or configurations. Spring Boot 3.3: Spring MVC

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. The controller method returns response data

@RestController is a Spring MVC annotation, not a Spring Boot-only feature. It combines @Controller with @ResponseBody, so the method’s return value is handled as response content rather than as a view name. A plain @Controller commonly returns a view name, although its methods can also use response-body behavior when configured to do so. Spring Getting Started: Building a RESTful Web Service Spring Boot Reference: Spring MVC annotations

5. A message converter writes the HTTP representation

Spring MVC selects a suitable HttpMessageConverter to turn the returned value into response content. The available converters and the negotiated media type affect what the client receives; the request’s Accept header can be part of that negotiation. A returned object does not guarantee JSON in every application, because dependencies, response type, configuration, and available representations matter.

For Spring Boot 4.1.1 specifically, the how-to guide describes default JSON rendering when Jackson 3 is available. That release-specific detail should not be treated as a requirement for earlier Boot versions. Spring Boot 4.1.1: Spring MVC

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What can change the usual path?

  • Filters and servlet mappings: Applications can register additional filters or servlets, change URL mappings, or customize filter order.
  • Other request destinations: A request may be handled by another servlet, a static-resource handler, or an error path rather than a controller method.
  • Custom MVC configuration: Handler mappings and path-matching configuration can alter which controller, if any, matches.
  • Application stack: This flow describes Spring MVC on the servlet stack. It should not be conflated with Spring WebFlux request handling.
  • Boot release: Defaults and implementation details can vary by version, so verify claims against the documentation for the application’s release.

Boot’s auto-configuration makes the conventional MVC setup convenient when the relevant dependencies are present, but neither the routing annotations nor @RestController are proprietary Boot annotations. Spring Getting Started: Building a RESTful Web Service Spring Boot Reference: Spring MVC annotations

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.