To build a Spring MVC architecture diagram, you map the request path from the servlet container through Spring's dispatcher to your controllers, services, and repositories, then draw those layers with every component labeled by its real class or module name. The key condition is that the diagram must match your actual configuration: annotation-driven or XML, embedded or external container, and the specific view strategy you use. A generic box chart copied from a tutorial will mislead readers the moment your code diverges from it. Spring MVC has a stable, well-documented flow, so you can draw it accurately from knowledge of how the framework works and how your project is wired, without guessing.
This guide walks through the layers to include, the request sequence to draw, the notation choices that keep the diagram readable, and a worked example you can adapt. It also covers the mistakes that turn architecture diagrams into decoration and the checks that tell you the drawing is finished.
Start with the layers you actually have
Spring MVC is a layered request-processing framework, and a useful architecture diagram mirrors those layers instead of flattening them into one row of boxes. At minimum, your application has these layers:
Client — browser, mobile app, or another service issuing HTTP requests. Servlet container — Tomcat, Jetty, Undertow, or an external app server. It hosts the DispatcherServlet and manages the HTTP connection lifecycle. Web layer — the DispatcherServlet (front controller), handler mappings, controllers, argument resolvers, and message converters. Service layer — your business logic, typically @Service beans, transactions, and validation orchestration. Persistence layer — repositories, ORM or JDBC access, and the database itself. Cross-cutting concerns — security filters, interceptors, exception handlers, and logging that touch more than one layer.
Not every project has a separate service layer. Small applications sometimes let controllers call repositories directly, and that's fine. The diagram should show what exists, not what a textbook says should exist. If your controllers talk straight to a repository, draw that edge. A reader who compares the diagram to the code and finds imaginary layers loses trust in the whole document.
Decide early whether you're drawing one application or a system. A single Spring MVC app fits one diagram. If the app calls external services, queues, or a separate front end, add a boundary box around your application and show external dependencies outside it. That boundary is often the most useful thing in the drawing because it answers "what would break if this service fails?"
Prerequisites before you open a drawing tool
You need accurate inputs, not artistic skill. Gather these first:
1: The build file (pom.xml or build.gradle). Note the Spring Boot or Spring Framework version, spring-webmvc, and any templating or JSON libraries. 2: The main configuration — @SpringBootApplication, WebMvcConfigurer implementations, spring.mvc.* properties, or XML config if the project is older. 3: A class inventory — list controllers, services, repositories, filters, interceptors, and @ControllerAdvice classes with their package names. 4: The request mappings — export or list @RequestMapping, @GetMapping, and related annotations so you can trace at least one real endpoint end to end. 5: External dependencies — database type, message brokers, HTTP clients, and authentication providers.
A package listing and a handful of annotations give you everything a technically honest diagram needs. If you can't identify a component's role from the code, mark it as undetermined rather than inventing a responsibility for it.
Draw the request flow in order
The value of a Spring MVC architecture diagram comes from showing sequence, not just boxes. Draw these steps in the order they execute for a typical request:
1: Client sends HTTP request. Label the method and path of a real endpoint, such as GET /orders/42. 2: Servlet container receives it. The container maps the request to the DispatcherServlet based on servlet mapping (/ by default in Spring Boot). 3: DispatcherServlet consults handler mappings. RequestMappingHandlerMapping matches the URL and method to a controller method. 4: Handler interceptors run before the controller, if configured. Filters sit outside the dispatcher entirely and belong on the container side of the line. 5: Argument resolvers bind the request to method parameters — path variables, query parameters, headers, and request bodies via HttpMessageConverter. 6: Controller executes and delegates to the service layer. 7: Service layer applies business rules and calls repositories inside a transaction boundary. 8: Repository accesses the database and returns domain objects. 9: Controller returns a result — a view name for server-rendered pages, or a response body serialized to JSON. 10: View resolvers render the view, or message converters write the body, and the response travels back through interceptors to the client. 11: Exception handlers (@ExceptionHandler, @ControllerAdvice, or HandlerExceptionResolver) intercept failures at the appropriate point and produce error responses.
Numbering the arrows on the diagram makes this sequence readable without a separate legend. If you have room, label each arrow with a short verb phrase ("binds arguments," "queries database") rather than a bare line.
A common confusion: filters (Servlet API) and interceptors (Spring) are different mechanisms at different positions in the chain. Filters wrap the dispatcher; interceptors run inside it. Draw them on opposite sides of the DispatcherServlet box. Getting this right signals that the diagram reflects the framework's actual mechanics.
Choose notation that survives review
You don't need formal UML, but consistency matters more than style. A few rules keep the drawing useful:
Boxes are components. Put the stereotype or role inside the box (Controller, Service, Repository) and the concrete class or module name beneath it. Arrows are dependencies or data flow. Pick one meaning and stick to it. Mixing "calls" and "returns data" arrows on the same line creates ambiguity. A common compromise is solid arrows for synchronous calls and dashed arrows for returns or asynchronous paths. Group by layer with labeled bands or background rectangles. Layer bands make it obvious when a dependency skips a layer. External systems sit outside the application boundary. Databases, identity providers, and downstream APIs should be visually distinct. Label important protocols. HTTP, JDBC, JPA, or REST on the edge tells readers how the boundary is crossed.
If your team uses C4 model conventions, a Level 2 container diagram or Level 3 component diagram maps naturally onto Spring MVC: the container is your application, and the components are controllers, services, and repositories. C4 gives you vocabulary for zooming in and out, which helps when one diagram can't hold everything.
A worked example you can adapt
Suppose you maintain an order management service. Your inventory includes OrderController (@RestController), OrderService (@Service with @Transactional), OrderRepository (a Spring Data JPA interface), a SecurityFilterChain configuration, a GlobalExceptionHandler (@ControllerAdvice), and a PostgreSQL database. Here's how the diagram organizes:
Client band: "Web storefront" and "Partner API client," both sending HTTPS. Container band: Tomcat with the security filter chain drawn as a vertical bar in front of the dispatcher. Web layer: DispatcherServlet at the center, RequestMappingHandlerMapping feeding it, OrderController with a note listing endpoints (GET /orders/{id}, POST /orders), HttpMessageConverter for JSON, and GlobalExceptionHandler attached to the controller group. Service layer: OrderService with a transaction marker on its boundary and a note about validation. Persistence layer: OrderRepository and a JPA / Hibernate adapter box, then PostgreSQL outside the application boundary. External systems: a payment gateway called from OrderService, drawn outside the boundary with a REST label.
Now trace one request: client → HTTPS → filter chain → DispatcherServlet → handler mapping → OrderController.getOrder → OrderService.findOrder → OrderRepository.findById → PostgreSQL → domain object returns up the chain → HttpMessageConverter serializes JSON → response. The failure path branches at the controller: an OrderNotFoundException routes to GlobalExceptionHandler, which produces a 404 body. Both paths belong on the diagram, because error handling is where architecture diagrams usually go silent and readers get surprised in production.
That example is illustrative, not a report of a specific codebase. Your class names, endpoints, and transaction boundaries will differ, and copying the shape without the names defeats the purpose.
Handle the variants that change the picture
Spring MVC diagrams diverge in a few predictable ways. Address them explicitly so the drawing doesn't imply uniformity where none exists.
Server-rendered versus REST. If you use Thymeleaf, JSP, or FreeMarker, add a ViewResolver and View step after the controller, and show HTML crossing back to the browser. If you return JSON via @RestController or @ResponseBody, show the message converter instead. Many applications do both; draw both paths and label which endpoints use which.
Spring Boot versus classic Spring. Spring Boot auto-configures the dispatcher and embedded container, so the diagram can treat them as framework-provided. A classic WAR deployment on an external Tomcat or WebLogic needs the container and web.xml or WebApplicationInitializer shown as explicit components, because operations teams care about that deployment boundary.
Reactive versus servlet. Spring WebFlux is a different stack with a different front controller (DispatcherHandler) and non-blocking contracts. Don't mix WebFlux components into a Spring MVC diagram; if your app uses both, draw two clearly separated stacks.
Security placement. Spring Security's filter chain sits before the dispatcher. Method-level security (@PreAuthorize) sits inside the service or controller. Show both positions if both are used, since they fail differently and are configured in different places.
Version differences worth checking. Configuration style and defaults have shifted across Spring Framework and Spring Boot releases over the years. Before you label a component as auto-configured or annotate a default path, confirm against the version in your build file and the official reference documentation for that release. The structural flow — dispatcher, handler mapping, controller, service, repository, view or message converter — has been stable for a long time, but configuration details are version-specific, and a diagram that asserts the wrong default is worse than one that stays general.
Make the diagram readable in review
An architecture diagram gets used in onboarding, incident reviews, and design discussions. Those audiences need different things from the same picture, so optimize for scanning:
Put the request flow left to right or top to bottom, not in a circle. Readers follow a predictable path. Keep one primary flow per diagram. If you need to show batch jobs or scheduled tasks, give them a separate diagram or a clearly separated region. Annotate non-obvious edges. A dashed line from the service to a message queue with "publishes OrderPlaced" explains more than the line alone. State the scope in a caption. "Order service, Spring Boot 3.x, servlet stack, JSON API only" prevents readers from assuming the diagram covers endpoints it doesn't. Include the error path at least once, as in the worked example. Mark anything you couldn't verify. A question mark on an uncertain component is honest; a confident wrong box is not.
Text-based diagramming tools such as PlantUML, Mermaid, or Structurizr keep the diagram in version control alongside the code, which means it can be reviewed in pull requests and updated when the architecture changes. Hand-drawn exports go stale silently. Whatever tool you choose, store the source next to the application so the next person can edit rather than redraw.
Check that the diagram is finished
A diagram is done when a reader can answer specific questions from it. Run these checks before you publish:
1: Can someone trace a real endpoint end to end? Pick two endpoints, one success and one failure, and follow the arrows. If a step is missing, add it. 2: Does every box map to something in the code or infrastructure? Search for each class or module name. Remove boxes that don't exist. 3: Are layer-skipping dependencies visible? A controller calling a repository directly should show that edge, not hide it behind a service box. 4: Is the boundary clear? Everything outside the application box should be something you don't deploy. 5: Do the labels match the version in the build file? Recheck configuration claims against the reference docs for your release. 6: Would a new team member know where to add a feature? If the diagram doesn't suggest where a new endpoint or service belongs, it's missing structural information.
If a check fails, fix the diagram rather than adding a footnote. Footnotes don't survive screenshots.
Common mistakes and how to avoid them
The most frequent failure is drawing the framework's generic flow and calling it your architecture. A diagram with "Controller → Service → Repository" and no names tells a reader nothing they couldn't learn from a tutorial. Name the classes.
The second mistake is omitting the container and filters, which makes security and deployment invisible. The third is showing only the happy path, which hides where errors are handled and misleads during incident response. A fourth is mixing stacks — WebFlux and MVC, or servlet filters and Spring interceptors drawn as one thing — which produces a diagram that is wrong in exactly the places engineers need it right.
Finally, avoid diagram sprawl. One diagram that tries to show every endpoint, scheduled job, and integration becomes unreadable. Split by concern: one for the request path, one for integrations, one for deployment. Each diagram should answer one question well.
If you maintain the diagram in text form, a quick review of the source against the current controller and configuration files takes minutes and catches most drift. That habit matters more than the initial drawing, because architecture diagrams fail by becoming stale, not by being ugly.
FAQ
Do I need UML to draw a Spring MVC architecture diagram?
No. Consistent boxes, labeled arrows, and layer groupings communicate more clearly than formal UML for most teams. If your organization already uses C4 or UML conventions, follow them for consistency, but the framework doesn't require any particular notation.
Should the diagram show Spring Boot auto-configuration?
Show it as framework-provided behavior, not as boxes you own. A note on the dispatcher or container box saying "auto-configured by Spring Boot" is enough. Confirm the specific defaults against the reference documentation for your Boot version before asserting them.
How detailed should the persistence layer be?
Enough to show how data leaves the application: the repository interface, the ORM or JDBC mechanism, and the database outside the boundary. Entity relationship diagrams are a separate artifact; don't overload the architecture diagram with table columns.
Where do interceptors and filters go?
Filters belong on the container side, before the DispatcherServlet. Interceptors belong inside the dispatcher's handling path, before and after the controller. Drawing them on the correct side of the dispatcher box is one of the clearest signals that the diagram reflects how Spring MVC actually works.