Spring Boot Tutorial — Complete Guide

A complete, hands-on Spring Boot tutorial series. Learn Spring Boot from scratch through to expert level — REST APIs, Spring Security, JPA, Testing, Microservices, Docker, Kubernetes, and Spring Boot 4.0.

Spring Boot Tutorial — Complete Guide

This tutorial series takes you from zero to expert. Every article is hands-on with real, runnable code. We build a complete order-service REST API throughout the series, adding features in each part.

Spring Boot version: 4.0 throughout (with notes on 3.x equivalents where relevant).


Part 1: Getting Started

  1. Introduction to Spring Boot — What It Is and Why It Exists
  2. Your First Spring Boot Application
  3. Project Structure Explained
  4. How Auto-Configuration Works
  5. Application Configuration: Properties, YAML, and Profiles
  6. Spring IoC and Dependency Injection
  7. Bean Scopes and Lifecycle

Part 2: Building REST APIs

  1. Building Your First REST API
  2. Handling Requests: Path Variables, Query Params, and Request Bodies
  3. DTOs and Response Shaping
  4. Bean Validation: @Valid, Custom Validators
  5. Global Exception Handling with @ControllerAdvice
  6. Pagination and Sorting
  7. API Documentation with OpenAPI and Springdoc

Part 3: Data Access with Spring Data JPA

  1. Introduction to Spring Data JPA
  2. JPA Entity Mapping
  3. CRUD Operations with JpaRepository
  4. Entity Relationships: @OneToMany, @ManyToMany
  5. JPQL, @Query, and Native Queries
  6. Transactions: @Transactional, Propagation, and Isolation
  7. Database Migrations with Flyway
  8. Spring Data with PostgreSQL

Part 4: Spring Security

  1. Spring Security Fundamentals
  2. Password Encoding and User Authentication
  3. JWT Authentication: Build a Complete Login System
  4. Role-Based Access Control with @PreAuthorize
  5. OAuth2 Resource Server
  6. OAuth2 Authorization Server with Spring Security 7

Part 5: Testing

  1. Unit Tests with JUnit 5 and Mockito
  2. Testing the Repository Layer with @DataJpaTest
  3. Testing the Web Layer with @WebMvcTest
  4. Integration Testing with @SpringBootTest and Testcontainers
  5. Testing Secured Endpoints

Part 6: Production-Ready Features

  1. Spring Boot Actuator
  2. Logging: SLF4J, Logback, and Structured Logging
  3. Externalized Configuration with @ConfigurationProperties
  4. Graceful Shutdown and Production Readiness

Part 7: Performance

  1. JPA Performance: N+1, Lazy Loading, and Query Optimization
  2. Caching with Caffeine and Redis
  3. Async Processing and Virtual Threads
  4. GraalVM Native Images

Part 8: Messaging and Event-Driven Architecture

  1. Introduction to Messaging with Apache Kafka
  2. Producing and Consuming Kafka Messages
  3. The Transactional Outbox Pattern
  4. Building a Modular Monolith with Spring Modulith

Part 9: Microservices

  1. Microservices Architecture: When to Split
  2. Service Discovery with Eureka
  3. API Gateway with Spring Cloud Gateway
  4. Spring Cloud Config Server
  5. Resilience Patterns with Resilience4j
  6. Inter-Service Communication: OpenFeign and RestClient

Part 10: Containers and Cloud

  1. Dockerizing Spring Boot Applications
  2. Spring Boot on Kubernetes
  3. Full Observability: Prometheus + Grafana + Tempo + Loki

Part 11: Spring Boot 4 and Modern Java

  1. What’s New in Spring Boot 4.0
  2. Migrating from Spring Boot 3.x to 4.0
  3. Null Safety with JSpecify
  4. API Versioning in Spring Boot 4
  5. Spring AI: Build a RAG Application