Spring Boot – Get Started

June 11, 20264 min readUpdated 8/18/2026

Spring Boot is the fastest way to get a production-grade Java service running, and the most widely used server-side Java framework there is. This track teaches it from the beginning, and every code sample is lifted from one real application rather than invented for the article.

What Spring Boot actually gives you

Plain Spring is a dependency injection container plus a large family of libraries. It is powerful and it asks you to wire everything yourself: XML or Java configuration, a servlet container to deploy into, versions of thirty libraries that have to agree with each other.

Spring Boot keeps the container and removes the wiring. Three ideas do almost all of the work:

  • Starters. One dependency pulls in a coherent set of libraries at versions known to work together.
  • Auto-configuration. Boot looks at what is on your classpath and creates the beans you would have written by hand — and backs off the moment you define your own.
  • An embedded server. Your application is the process. No WAR file, no Tomcat to install, java -jar and it is serving.

The result is a REST endpoint in about fifteen lines and no configuration at all.

Versions this track is written against

Spring Boot 4 is a genuine break from 3, and Spring Framework 7 with it. Several things in this track will not compile on Boot 3, and they are called out where they appear.

ComponentVersion
Spring Boot4.1.0
Spring Framework7.0.8
Java21 (the minimum for Boot 4)
BuildMaven, with a Gradle equivalent in lesson 33
DatabaseMySQL, schema owned by Liquibase
springdoc-openapi2.8.6
MapStruct1.6.3
jjwt0.12.6

Java 21 is not optional. Spring Boot 4 requires it. If java -version reports 17, stop here and upgrade — every sample below assumes 21.

Create a project

The Spring Initializr generates the skeleton. Use the web UI at start.spring.io, or curl it directly:

curl https://start.spring.io/starter.zip \
  -d type=maven-project \
  -d language=java \
  -d bootVersion=4.1.0 \
  -d javaVersion=21 \
  -d groupId=com.example \
  -d artifactId=demo \
  -d dependencies=web,data-jpa,validation,lombok \
  -o demo.zip

unzip demo.zip -d demo && cd demo

You get a pom.xml, one Java class, an empty application.properties and a Maven wrapper. That is the whole project.

package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication {

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

@SpringBootApplication is three annotations in one: @SpringBootConfiguration, @EnableAutoConfiguration and @ComponentScan. That last one scans this class's package and everything below it, which is the single structural decision you cannot get wrong — a class in a sibling package is invisible to Spring, and the failure is a confusing "no qualifying bean" rather than anything that mentions packages. Lesson 4 covers the layout that follows from this.

Your first endpoint

Add one class:

package com.example.demo;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @GetMapping("/hello")
    public String hello(@RequestParam(defaultValue = "world") String name) {
        return "Hello, " + name;
    }
}
./mvnw spring-boot:run

# in another terminal
curl "http://localhost:8080/hello?name=Spring"
# Hello, Spring

No server installed, no XML, no web.xml, no deployment step. That is the pitch, and the rest of this track is about what Boot is doing on your behalf and when you should take over.

The application every example comes from

Tutorial snippets invented to illustrate a point tend to fall apart the moment you try to use them, because they never had to survive contact with anything. Every snippet in this track is copied from a working pizza-ordering API — the backend of a Pizza Hut-style storefront:

  • Browse a menu, build a pizza, add to a server-side cart, check out as a guest or signed in
  • Stripe payments, with the server recomputing every price
  • JWT authentication, customer profiles, saved addresses and cards
  • An admin area with catalogue management and reports built on real database aggregates

It runs on Java 21 and Spring Boot 4.1.0, is covered by 60 tests, and its package layout is the one lesson 4 recommends. When a lesson says "here is how the pizza API does it", that is code that compiles and runs, not a sketch.

How to read this track

The lessons build on each other and are meant to be read in order, but each one stands alone well enough to be used as a reference later.

Part 1 — Getting started

  1. Get Started — you are here
  2. What Spring Boot actually does — starters, auto-configuration, the embedded server
  3. From Spring to Spring Boot, and Boot 3 to 4
  4. Structuring a project

Part 2 — The container

  1. Beans, scopes and lifecycle
  2. Dependency injection
  3. Configuration, profiles and properties
  4. Aspect-oriented programming
  5. Application events

Part 3 — The web layer

  1. Spring Web MVC
  2. Building a REST API
  3. Exception handling
  4. File upload
  5. API docs with springdoc-openapi
  6. Server-rendered pages with Thymeleaf

Part 4 — Data

  1. JPA and Hibernate
  2. JdbcTemplate
  3. Schema migrations with Liquibase
  4. Mapping DTOs with MapStruct
  5. Lombok
  6. Caching
  7. Elasticsearch

Part 5 — Security

  1. How Spring Security authenticates
  2. Configuring the filter chain
  3. Stateless API auth with JWT
  4. Method-level security
  5. OAuth2

Part 6 — Async and integration

  1. Async work and thread pools
  2. Retries
  3. Messaging with JMS
  4. Sending email

Part 7 — Build, test, reference

  1. Testing
  2. Building with Gradle
  3. Cheat sheet
  4. Interview questions

What you need before lesson 2

  • JDK 21. Check with java -version.
  • An IDE — IntelliJ IDEA or VS Code with the Java extensions.
  • Java fundamentals — classes, interfaces, generics, lambdas. This track teaches Spring, not Java.
  • MySQL, from lesson 16 onwards. Nothing before that needs a database.

Next: what Spring Boot actually does — how one dependency becomes twelve, and how to see every decision auto-configuration made on your behalf.