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 takes an opinionated view of the Spring platform so that new and existing users can quickly get to the parts they need. It provides a radically faster and widely accessible getting-started experience for all Spring development — without code generation and without requiring XML configuration.

What is Spring Boot?

Spring Boot helps you create stand-alone, production-grade Spring-based applications that you can run with java -jar or deploy as traditional WAR files. Most Spring Boot applications need very little Spring configuration because the framework makes sensible decisions on your behalf, then steps aside as soon as your requirements diverge from its defaults.

Primary goals

  • Provide a radically faster and widely accessible getting-started experience for all Spring development.
  • Be opinionated out of the box but get out of the way quickly as requirements diverge from the defaults.
  • Provide a range of non-functional features common to large classes of projects — embedded servers, security, metrics, health checks, and externalized configuration.
  • Absolutely no code generation (when not targeting native image) and no requirement for XML configuration.

Key features

Auto-configuration

Spring Boot guesses how you want to configure Spring based on the jar dependencies you have added. Add spring-boot-starter-webmvc and it configures Tomcat and Spring MVC automatically.

Starter dependencies

Starters are convenient dependency descriptors that give you a one-stop shop for all the Spring and related technology you need — no hunting through sample code or copy-pasting dependency descriptors.

Embedded servers

Package your application as an executable jar with an embedded Tomcat, Jetty, or Undertow server. No need to deploy WAR files to an external container.

Spring Boot Actuator

Add production-ready features such as health checks, metrics, and externalized configuration with the spring-boot-starter-actuator dependency.

Native image support

Compile your Spring Boot application to a GraalVM native image for instant startup and reduced memory footprint.

Spring CLI

A command-line tool that lets you quickly prototype Spring applications using Groovy scripts with automatic dependency resolution.

A minimal Spring Boot application

The following example is a complete Spring Boot web application. It requires no XML configuration and no external web server — just a single Java class.
MyApplication.java
import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.web.bind.annotation.*;

@RestController
@SpringBootApplication
public class Example {

    @RequestMapping("/")
    String home() {
        return "Hello World!";
    }

    public static void main(String[] args) {
        SpringApplication.run(Example.class, args);
    }

}
  • @SpringBootApplication combines @SpringBootConfiguration, @EnableAutoConfiguration, and @ComponentScan into a single meta-annotation.
  • @EnableAutoConfiguration tells Spring Boot to configure the application context based on the jar dependencies on the classpath.
  • @RestController marks the class as a web controller whose methods return response bodies directly.
  • SpringApplication.run() bootstraps the application and starts the embedded Tomcat server.
Auto-configuration is designed to work well with starters, but the two concepts are not directly tied. You are free to pick individual jar dependencies — Spring Boot still does its best to auto-configure your application.

Where to go next

Quickstart

Build and run your first Spring Boot application in minutes.

Installation

System requirements, Spring Initializr, Maven, Gradle, and the Spring CLI.

Build systems

Dependency management, starters, and build plugin references for Maven and Gradle.

Build docs developers (and LLMs) love