How a request travels

One GET /api/v1/orders/42, from the socket to MySQL and back.

Analogy cheat-sheet: a bank branch

You walk in and ask for the statement of account 42. Every Spring Boot layer has a person in that branch. Each step below adds an "In real life" note in these terms.

In real life (bank branch)In Spring Boot
You, with a request slipThe HTTP client
A free teller who serves you start to finishTomcat worker thread (up to 200)
Security guard at the doorServlet filters (Spring Security)
Help desk that reads your slipDispatcherServlet
Directory board: "Statements → counter 3"HandlerMapping
Counter's own checks and sign-out sheetHandlerInterceptor
Assistant who turns your scribble into a proper formHandlerAdapter + Jackson + @Valid
Clerk with a numbered "transaction folder"@Transactional service (AOP proxy)
Vault key hook with 10 keysHikariCP connection pool
The vault with the ledgersMySQL

The same trip as real code

This is all you write. Everything else in the diagram happens around it.

@RestController
class OrderController {
    @GetMapping("/api/v1/orders/{id}")        // HandlerMapping finds this method
    Order get(@PathVariable Long id) {        // HandlerAdapter turns "42" into a Long
        return service.find(id);              // goes through the service proxy
    }
}

@Service
class OrderService {
    @Transactional(readOnly = true)           // proxy opens the "folder" and borrows a key
    Order find(Long id) {
        return repo.findById(id)              // Hikari key, then MySQL
                   .orElseThrow(() -> new OrderNotFoundException(id));  // exception path
    }
}

@RestControllerAdvice                         // the pre-printed rejection letters
class Errors {
    @ExceptionHandler(OrderNotFoundException.class)
    ResponseEntity<?> notFound(OrderNotFoundException e) {
        return ResponseEntity.status(404).body(
            Map.of("error", "ORDER_NOT_FOUND", "message", e.getMessage(), "status", 404));
    }
}

Insight: three places to intercept, three altitudes

Servlet FilterHandlerInterceptorAOP proxy (@Transactional, @Aspect)
Belongs toServlet containerSpring MVCSpring bean
RunsBefore DispatcherServletAround the controller callAround any bean method
KnowsRaw request/responseWhich controller method was matchedMethod, arguments, return value
Use forAuth, CORS, request IDs, access logsPer-endpoint checks, timing by handlerTransactions, caching, audit

Trade-off: one thread per request

Spring MVC on Tomcat is blocking. A worker thread (default max 200) and a Hikari connection (default max 10) are held for the whole request. It is simple to reason about and debug. It stops scaling when requests wait on slow I/O, because threads pile up. WebFlux or virtual threads (spring.threads.virtual.enabled=true, Boot 3.2+) change that trade.

Where to look when…

SymptomSuspect
401/403 and your controller never logsSecurity filter chain. It rejects before DispatcherServlet.
404 for a URL that "should" existHandlerMapping: wrong path, verb or Content-Type; component scan missed the controller.
400 with a body-parse or validation errorArgument resolver: Jackson deserialization or @Valid.
Slow requests, DB looks idleHikari pool exhausted or long @Transactional methods. See chapter 2.
Data written, then half-rolled back or not at allSelf-invocation bypassed the proxy, or a checked exception committed.

Recap