Learn Spring Boot

Opinionated Java framework for production-ready web services and apps

22 lessons · 5 hours · 4 levels · covers Spring Boot 3.5

Spring Boot builds on the Spring Framework to create stand-alone, production-ready Java applications with minimal configuration: starters pull in consistent dependencies, auto-configuration wires sensible defaults, and an embedded server runs the app as a plain jar. It is the most widely used way to build REST APIs, microservices and data-backed backends on the JVM. Learning it means learning dependency injection, Spring MVC, Spring Data, testing and operations the way most Java teams practise them.

Before you start

Spring Boot builds on these; the tree links to the exact lessons you need.

How deep do you want to go?

1. EssentialsRead and write simple code, do the everyday basics8 lessons · 2 hours in total
2. PracticalUse it productively at work, with the usual idioms14 lessons · 3 hours in total
3. AdvancedThe less common features, performance and trade-offs19 lessons · 4 hours in total
4. ExpertInternals and the edge cases experts know22 lessons · 5 hours in total

The Spring Boot tree

Spring BootCreating a Spring Boot appCreating a SpringBoot appBeans and dependency injectionBeans anddependency injectionapplication.properties and @Valueapplication.properti…and @ValueBuilding and running the jarBuilding and runningthe jarREST controllers and request mappingREST controllers andrequest mappingRequest bodies and status codesRequest bodies andstatus codesSpring Data JPA repositoriesSpring Data JPArepositoriesTesting with @SpringBootTest and @WebMvcTestTesting with@SpringBootTest a…Validating inputValidating inputError handling and ProblemDetailError handling andProblemDetailTyped configuration and profilesTyped configurationand profilesTransactions with @TransactionalTransactions with@TransactionalCalling HTTP APIs with RestClientCalling HTTP APIswith RestClientActuator: health, metrics and infoActuator: health,metrics and infoPackages, Maven and GradlePackages, Mavenand GradleInterfacesInterfacesRecordsRecordsUnit testing with JUnit 5Unit testing withJUnit 5ExceptionsExceptionsVirtual threadsVirtual threadsAnnotations and reflectionAnnotations andreflectionClass loading and initializationClass loading andinitialization
Essentials and Practical shown (14 of 22 lessons); the full list is below. Click a lesson to read it.

All 22 lessons, in order

Getting started

  1. Creating a Spring Boot app · Essentials · 10 min

    Generate a project with Spring Initializr, understand starters and @SpringBootApplication, and run it.

  2. Beans and dependency injection · Essentials · 12 min

    Let the Spring container create your objects (beans) and inject their dependencies through constructors.

  3. Building and running the jar · Essentials · 8 min

    Run during development with the Maven or Gradle plugin, package an executable jar and use DevTools.

Configuration

  1. application.properties and @Value · Essentials · 10 min

    Configure your app and Boot's components with application.properties or YAML, and read values with @Value.

  2. Typed configuration and profiles · Practical · 14 min

    Bind groups of settings to validated @ConfigurationProperties records and switch environments with profiles.

Web APIs

  1. REST controllers and request mapping · Essentials · 14 min

    Map HTTP requests to methods with @RestController, @GetMapping, @PathVariable and @RequestParam.

  2. Request bodies and status codes · Essentials · 12 min

    Accept JSON with @RequestBody, return 201 Created with a Location header, and handle PUT and DELETE.

  3. Validating input · Practical · 12 min

    Validate request bodies and parameters with Jakarta Bean Validation annotations and @Valid.

  4. Error handling and ProblemDetail · Practical · 14 min

    Map exceptions to HTTP responses with @RestControllerAdvice, @ExceptionHandler and RFC 9457 ProblemDetail.

  5. Calling HTTP APIs with RestClient · Practical · 12 min

    Call other services with the fluent RestClient and declarative @HttpExchange interfaces.

  6. Securing APIs with Spring Security · Advanced · 18 min

    Configure a SecurityFilterChain for authentication and authorization, including JWT resource servers.

Data access

  1. Spring Data JPA repositories · Essentials · 15 min

    Map entities with JPA annotations and get CRUD and derived queries from repository interfaces.

  2. Transactions with @Transactional · Practical · 14 min

    Group database work into atomic units with @Transactional and understand rollback rules and propagation.

  3. JPA performance: N+1, fetching and projections · Advanced · 16 min

    Detect and fix N+1 queries, choose fetch strategies, and read data efficiently with projections and paging.

Testing

  1. Testing with @SpringBootTest and @WebMvcTest · Essentials · 15 min

    Write unit tests without Spring, slice tests for controllers with MockMvc, and full integration tests.

  2. Integration tests with Testcontainers · Advanced · 14 min

    Run tests against real databases and brokers in Docker with Testcontainers and @ServiceConnection.

Production

  1. Actuator: health, metrics and info · Practical · 12 min

    Expose health checks, metrics and runtime info for operating the app with Spring Boot Actuator.

  2. Scheduling, async and virtual threads · Advanced · 14 min

    Run periodic jobs with @Scheduled, background work with @Async, and scale blocking code with virtual threads.

Under the hood

  1. How auto-configuration works · Advanced · 16 min

    Conditional configuration classes, @ConditionalOnMissingBean and the conditions report.

  2. Bean lifecycle, proxies and AOP · Expert · 18 min

    How the container creates beans, where BeanPostProcessors and proxies come in, and why self-invocation breaks.

  3. Writing your own starter · Expert · 16 min

    Package shared configuration as an auto-configuration module with conditions, properties and metadata.

  4. Native images, AOT and startup tuning · Expert · 18 min

    Compile Spring Boot apps ahead of time to GraalVM native images, and speed up JVM startup with CDS.