What is Spring Boot?
Spring Boot is a framework built on top of the Spring Framework. It lets you create stand-alone, production-ready applications with very little configuration. You write your business code, and Spring Boot sets up the server, the database connection, JSON conversion, logging and much more for you. The latest stable line is Spring Boot 4.1 (June 2026), and it needs Java 17 or higher (Java 21 or higher is recommended).
Spring Framework vs Spring Boot
| Point | Spring Framework | Spring Boot |
|---|---|---|
| Configuration | You write XML or Java configuration for everything | Auto-configuration sets sensible defaults |
| Server | Build a WAR and deploy to an external Tomcat | Embedded Tomcat inside the jar. Run with java -jar |
| Dependencies | You choose every library and its version | Starters and a tested version list (BOM) |
| Setup time | Hours or days | Minutes (start.spring.io) |
| Production tools | You build them | Actuator: health, metrics, info out of the box |
| Style | Flexible, but you configure a lot | Opinionated: defaults first, override when needed |
Main features
- Auto-configuration: Spring Boot looks at your classpath and creates the beans you probably need.
- Starters: one dependency brings a full set of compatible libraries (for example spring-boot-starter-data-jpa).
- Embedded server: Tomcat by default, Jetty and Undertow are options.
- Externalized configuration: properties, YAML, environment variables and command line arguments.
- Actuator: health checks, metrics and monitoring endpoints.
- No code generation and no XML needed.
- DevTools: automatic restart while you develop.
Version map
| Spring Boot | Spring Framework | Jakarta EE | Minimum Java | Notes |
|---|---|---|---|---|
| 3.x | 6.x | 10 | 17 | Moved from javax.* to jakarta.* packages |
| 4.x | 7.x | 11 | 17 (21+ recommended) | Modular code base, Jackson 3 by default, API versioning, JSpecify null-safety |
There is no LTS version in Spring Boot. A new minor version comes about every six months, and each minor version gets open source support for about 12 months. Always check the Spring Boot support page before choosing a version for a new project.
The smallest Spring Boot application
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
public class DemoApplication {
@GetMapping("/hello")
public String hello() {
return "Hello from Spring Boot";
}
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}What happens when you run it
main() ──► SpringApplication.run()
│
├─ 1. create the ApplicationContext (the bean container)
├─ 2. scan your packages for @Component, @Service, @RestController ...
├─ 3. run auto-configuration (DispatcherServlet, Jackson, DataSource ...)
├─ 4. start the embedded Tomcat on port 8080
└─ 5. publish ApplicationReadyEvent ──► app is readyThe Spring ecosystem map
| Project | Purpose | You use it for |
|---|---|---|
| Spring Framework | Core: IoC container, AOP, transactions, MVC, WebFlux, testing | Everything. Boot is built on it |
| Spring Boot | Auto-configuration, starters, embedded server, Actuator, packaging | Application setup and running |
| Spring Data | Repository abstraction for JPA, JDBC, MongoDB, Redis, Elasticsearch | Databases |
| Spring Security | Authentication, authorization, protection against attacks | Login, JWT, OAuth2, roles |
| Spring Cloud | Config server, gateway, discovery, circuit breakers, tracing | Microservices |
| Spring Batch | Chunk based batch jobs with restart | Imports, reports, migrations |
| Spring Integration / Kafka / AMQP | Messaging and enterprise integration patterns | Events and queues |
| Spring AI / GraphQL / Modulith | AI models, GraphQL APIs, modular monolith structure | Newer needs |
What Boot decides for you (opinionated defaults)
| Concern | Default choice | How to change |
|---|---|---|
| Web server | Tomcat on port 8080 | Exclude starter-tomcat, add Jetty or Undertow. server.port |
| JSON | Jackson (auto-registered modules for java.time, Optional, records) | spring.jackson.* or a JacksonBuilderCustomizer |
| Logging | Logback through SLF4J, console output, INFO level | logging.* properties or logback-spring.xml, or switch to Log4j2 |
| Connection pool | HikariCP | spring.datasource.hikari.* |
| ORM | Hibernate with Spring Data JPA | spring.jpa.* |
| Validation | Hibernate Validator (Bean Validation) | Own Validator bean |
| Testing | JUnit 5, Mockito, AssertJ, MockMvc, JsonPath | Exclude and add your own |
| HTTP client | RestClient / WebClient builders with Jackson | Customizers, spring.http.client.* |
The rule is: convention first, configuration only when you differ. Every default backs off when you define your own bean (see the auto-configuration page), so you can replace exactly one piece and keep the rest.
Layers of a typical Spring Boot application
Client (browser, mobile, other service)
│ HTTP / JSON
▼
┌────────────────────────── Spring Boot application (one JVM process, one jar) ──────────────────────────┐
│ Web layer @RestController URLs, status codes, DTO in/out, validation (@Valid) │
│ │ security filters (Spring Security) and cross-cutting filters run before this layer │
│ ▼ │
│ Service layer @Service business rules, transactions (@Transactional), events, caching │
│ ▼ │
│ Data layer @Repository Spring Data JPA / JDBC / Mongo, entities │
│ ▼ │
│ Infrastructure DataSource pool, Kafka/RabbitMQ clients, RestClient, cache, scheduler │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────┘
▼ ▼ ▼
Database Message broker Other servicesSpring Boot compared with alternatives
| Framework | Strength | Consider when |
|---|---|---|
| Spring Boot | Largest ecosystem, hiring pool, mature libraries, runs everywhere | Default choice for enterprise Java |
| Quarkus | Very fast startup and low memory (native image first), live coding | Serverless and tiny containers |
| Micronaut | Compile time dependency injection, fast startup | Low footprint microservices |
| Jakarta EE (WildFly, Payara) | Standards based, application server model | Existing EE estates |
| Helidon, Javalin, Vert.x | Lightweight or reactive | Special needs |
Spring Boot with virtual threads (Java 21+), CDS/AOT cache and optional GraalVM native image has closed much of the startup and memory gap. Choose by team skills and ecosystem first.
Suggested learning path
- 1. Boot basics, first project, auto-configuration and starters.
- 2. Core Spring: IoC, bean lifecycle, configuration, AOP.
- 3. Web: REST, validation, exception handling, JSON.
- 4. Data: JPA, Hibernate internals, transactions, migrations.
- 5. Security: Spring Security default behavior, JWT, OAuth2.
- 6. Production: logging, Actuator, testing, Docker, performance.
- 7. Integration: Kafka, RabbitMQ, resilience, Spring Cloud.
Common mistake: Thinking Spring Boot replaces Spring. It does not. Spring Boot is Spring with automatic setup. All Spring concepts (beans, DI, AOP, transactions) still apply.
Interview questions
Do I need XML configuration in Spring Boot?
No. Spring Boot uses Java annotations and properties or YAML files. XML is still possible but almost never needed.
Which server does Spring Boot use by default?
Embedded Apache Tomcat on port 8080. You can switch to Jetty or Undertow by changing the dependencies.
Is Spring Boot only for microservices?
No. It works for monoliths, REST APIs, web apps, batch jobs and microservices.
What is the difference between Spring Boot and Spring MVC?
Spring MVC is the web framework part of Spring Framework (controllers, DispatcherServlet). Spring Boot is the setup layer that configures MVC, Tomcat, Jackson and everything else automatically.
Can I use Spring Boot without Maven or Gradle?
Technically yes with the CLI or manual jars, but Maven or Gradle give you dependency management and the repackaging plugin. In practice always use one of them.