Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/spring-projects/spring-boot/llms.txt

Use this file to discover all available pages before exploring further.

Spring Boot provides a rich set of web starters that cover synchronous and reactive HTTP servers, template engines, API styles, and input validation. Each starter wires up its technology automatically when it lands on the classpath, so you can go from a blank project to a running web application by adding a single dependency.

Choosing a web stack

Use the Spring MVC stack when you need synchronous, thread-per-request processing, a large ecosystem of existing libraries, or you are migrating an existing servlet-based application.Start with spring-boot-starter-webmvc (or the legacy alias spring-boot-starter-web).
You cannot mix spring-boot-starter-webmvc and spring-boot-starter-webflux in the same application and have both fully active. If both are on the classpath, Spring MVC takes precedence. Use the reactive stack deliberately, not accidentally.

spring-boot-starter-webmvc

The primary starter for building REST APIs and server-rendered web applications with Spring MVC and an embedded Tomcat server. Includes: spring-boot-starter · spring-boot-starter-jackson · spring-boot-starter-tomcat · spring-boot-webmvc · spring-boot-http-converter
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>
When to use: Any new Spring MVC project. This supersedes the older spring-boot-starter-web alias.

spring-boot-starter-web

Legacy alias for spring-boot-starter-webmvc. The build description reads: “Starter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded container (deprecated in favor of spring-boot-starter-webmvc)”.
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
Prefer spring-boot-starter-webmvc for new projects. The spring-boot-starter-web name is retained for backward compatibility.

spring-boot-starter-webflux

Reactive web applications built on Spring WebFlux and backed by Reactor Netty as the embedded server. Includes: spring-boot-starter · spring-boot-starter-jackson · spring-boot-starter-reactor-netty · spring-boot-reactor · spring-boot-webflux
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
When to use: Non-blocking APIs, server-sent events, streaming responses, or high-concurrency microservices. A minimal reactive controller:
@RestController
public class GreetingController {

    @GetMapping("/greet")
    public Mono<String> greet() {
        return Mono.just("Hello, reactive world!");
    }
}

spring-boot-starter-websocket

Server-side WebSocket support via the Spring MVC WebSocket module (STOMP over WebSocket). Includes: spring-boot-starter · spring-boot-starter-webmvc · spring-boot-websocket
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
When to use: Chat applications, live dashboards, collaborative editing, or any feature requiring persistent bidirectional communication over HTTP. Pairs well with a JavaScript STOMP client.

spring-boot-starter-graphql

GraphQL API support via Spring for GraphQL, which integrates with both the MVC and WebFlux stacks. Includes: spring-boot-starter · spring-boot-starter-jackson · spring-boot-reactor · spring-boot-graphql
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-graphql</artifactId>
</dependency>
When to use: APIs where clients need to specify exactly which fields they want, or where you serve multiple client types (mobile, web, third-party) from one endpoint.
Pair with spring-boot-starter-webmvc or spring-boot-starter-webflux to expose the GraphQL endpoint over HTTP. The GraphiQL browser IDE is auto-configured at /graphiql when spring.graphql.graphiql.enabled=true.

spring-boot-starter-hateoas

Hypermedia-driven REST APIs using Spring HATEOAS (HAL, link relations). Includes: spring-boot-starter · spring-boot-starter-webmvc · spring-boot-hateoas
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
When to use: REST APIs that need to embed navigation links in responses (e.g., _links.self, _links.next) so clients can discover available actions without hard-coding URLs.

spring-boot-starter-jersey

JAX-RS web services using the Jersey reference implementation instead of Spring MVC. Includes: spring-boot-starter · spring-boot-starter-tomcat · spring-boot-starter-validation · spring-boot-jackson2 · spring-boot-jersey · jersey-bean-validation
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
When to use: Projects already using JAX-RS annotations (@Path, @GET, @POST) or integrating with other JAX-RS tooling. For greenfield projects, Spring MVC or WebFlux is typically preferred.

Template engine starters

Server-side HTML rendering with Thymeleaf, including Spring Security integration and natural templates (valid HTML files that work in a browser without a server).Includes: spring-boot-starter · spring-boot-thymeleaf
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
Templates are resolved from src/main/resources/templates/ by default.
src/main/resources/templates/index.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<body>
  <h1 th:text="${message}">Default text</h1>
</body>
</html>
Server-side HTML and text rendering with Apache FreeMarker. Suitable when you need a well-established, mature template language with extensive documentation.Includes: spring-boot-starter · spring-boot-freemarker
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
Templates are resolved from src/main/resources/templates/ with the .ftlh extension (HTML-escaped).
Logic-less server-side templates using Mustache. Because Mustache deliberately has no logic in the template, all view logic lives in the controller — a strong separation of concerns.Includes: spring-boot-starter · spring-boot-mustache
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-mustache</artifactId>
</dependency>
Templates are resolved from src/main/resources/templates/ with the .mustache extension.

spring-boot-starter-validation

Bean Validation (Jakarta Validation API) backed by Hibernate Validator, used to validate method parameters, request bodies, and configuration properties. Includes: spring-boot-starter · spring-boot-validation (which brings hibernate-validator)
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-validation</artifactId>
</dependency>
When to use: Any time you want to use @Valid, @NotNull, @Size, @Pattern, or custom ConstraintValidator implementations on REST request bodies, service method parameters, or Spring configuration classes.
@RestController
@RequestMapping("/users")
public class UserController {

    @PostMapping
    public ResponseEntity<User> create(@Valid @RequestBody CreateUserRequest request) {
        // request is guaranteed to satisfy all constraints
        return ResponseEntity.status(201).body(userService.create(request));
    }
}

public record CreateUserRequest(
    @NotBlank String username,
    @Email   String email,
    @Size(min = 8) String password
) {}
spring-boot-starter-webmvc does not include bean validation automatically. Add spring-boot-starter-validation explicitly to get @Valid support on controller method arguments.

Switching the embedded server

By default, MVC starters use Tomcat. To switch to Jetty or Undertow, exclude the Tomcat starter and add the replacement:
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-webmvc</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jetty</artifactId>
</dependency>

Build docs developers (and LLMs) love