Spring Boot Articles
A curated collection of articles covering Spring Boot from the basics to production operations, spanning beginner entry points to advanced design and operational topics.
-
Implementing CRUD REST API with Spring Boot - Basic Structure of Controller, Service, and Repository
A step-by-step guide to implementing CRUD (Create, Read, Update, Delete) REST API with Spring Boot. Build the three-layer architecture of Controller, Service, and Repository from scratch, and walk through setting up all four endpoints: GET, POST, PUT, and DELETE.
-
Implementing Kafka Producer and Consumer with Spring Boot
A hands-on guide to implementing Kafka Producer and Consumer from scratch in a Spring Boot application using spring-kafka. Covers the basics of KafkaTemplate and @KafkaListener, through to error handling, retries, and Dead Letter Topics, with a focus on code examples.
-
Spring Security Method Security - How to Implement RBAC with @PreAuthorize
Learn how to implement method-level Role-Based Access Control (RBAC) using @PreAuthorize/@PostAuthorize/@Secured in Spring Boot with practical code examples. Master fine-grained authorization control that cannot be achieved with SecurityFilterChain alone.
-
How to Implement Real-Time Communication with WebSocket in Spring Boot - Basics of STOMP and SockJS
Step-by-step guide to building a broadcast-style chat feature from scratch using Spring Boot + STOMP + SockJS. Covers @MessageMapping, SimpMessagingTemplate, and integration with Spring Security in a practical way.
-
How to Use Redis with Spring Boot - Implementation Patterns for Session Management, Caching, and Pub/Sub
Covers everything from basic RedisTemplate operations using spring-boot-starter-data-redis, to externalizing sessions with Spring Session, configuring Redis as a @Cacheable backend, and implementing Pub/Sub — organized by use case.
-
How to Configure CORS in Spring Boot - Choosing Between @CrossOrigin and WebMvcConfigurer
A practical guide to resolving CORS errors when calling Spring Boot REST APIs from frontends like React/Vue. Covers three patterns: @CrossOrigin, WebMvcConfigurer, and SecurityFilterChain, including common pitfalls when integrating Spring Security.
-
How to Auto-Generate REST API Documentation Using OpenAPI (Swagger UI) with Spring Boot
A practical guide covering the introduction of springdoc-openapi, enhancing documentation with annotations, configuring Bearer token for JWT-authenticated endpoints, and YAML output.
-
How to Create Custom Validation Annotations in Spring Boot
Learn how to define reusable custom validation rules as annotations using @Constraint and ConstraintValidator, covering three implementation patterns including phone number format validation, duplicate email checking, and password confirmation.
-
Server-Side Rendering with Thymeleaf in Spring Boot: Implementation Guide
A hands-on tutorial covering how to integrate Thymeleaf into Spring Boot, including embedding model attributes in HTML, form processing, displaying Bean Validation errors, and Spring Security integration—all in one comprehensive guide.
-
How to Send Emails with JavaMailSender in Spring Boot - From Gmail/SMTP Configuration to HTML Emails
A zero-to-production guide on sending emails with JavaMailSender. Covers Gmail SMTP configuration, plain text and HTML emails, asynchronous sending with @Async, and troubleshooting common authentication errors — all with practical code examples.
-
How to Achieve Loose Coupling Between Modules with Spring Boot ApplicationEvent
Explains event-driven design using ApplicationEvent and ApplicationEventPublisher with implementation examples. Covers post-transaction processing with @TransactionalEventListener, asynchronous event handling, and testing.
-
How to Compile Natively with GraalVM Native Image in Spring Boot 3.x
A practical guide to natively compiling Spring Boot 3.x projects with GraalVM Native Image. Covers AOT processing mechanisms, adding Reflection hints, leveraging native-image-agent, runtime verification with Testcontainers, and troubleshooting.
-
Implementing Distributed Tracing with Micrometer Tracing and Zipkin in Spring Boot 3.2+
A practical guide to implementing distributed tracing using Micrometer Tracing and Zipkin in Spring Boot 3.2 and later. Covers migration from the deprecated Spring Cloud Sleuth, trace ID propagation between services, and verification via the Zipkin UI.
-
How to Deploy a Spring Boot Application to Kubernetes
A step-by-step guide to deploying a Dockerized Spring Boot application to Kubernetes. Covers creating Manifests for Deployment, Service, ConfigMap, and Secret, as well as configuring Actuator health endpoints as livenessProbe/readinessProbe — practical patterns you can use in production.
-
Spring Boot 2.x to 3.x Migration Guide
Explains the causes and solutions for compilation errors and startup errors that occur when upgrading from Spring Boot 2.x to 3.x, with real code examples. Covers javax→jakarta replacement, SecurityFilterChain migration, and spring.factories deprecation, organized with a migration checklist.
-
How to Implement a Circuit Breaker with Resilience4j in Spring Boot
A hands-on guide to implementing circuit breakers with Resilience4j and Spring Boot. Covers how to use @CircuitBreaker, @Retry, and @RateLimiter, fallback design, and parameter configuration via application.yml with practical code examples.
-
How to Implement Google Login (OAuth2) with Spring Boot
A step-by-step guide to implementing Google social login from scratch using Spring Security OAuth2 Client. Covers everything from how the OAuth2 authorization code flow works to application.yml configuration and UserInfo retrieval, while building an app that runs in a local environment.
-
How to Achieve High Throughput with Virtual Threads in Spring Boot 3.2 + Java 21
A practical guide to enabling Virtual Threads from Java 21's Project Loom via spring.threads.virtual.enabled=true, measuring performance differences against the traditional thread model, and explaining changes in ThreadLocal behavior, pinning issues, and how to use @Async alongside Virtual Threads.
-
How to Implement File Upload and Download with REST API in Spring Boot - Using MultipartFile
Step-by-step guide to implementing file upload, storage, and download using MultipartFile. Covers size limit configuration, MIME type validation, exception handling, and production-ready code examples.
-
Visualizing Spring Boot Metrics with Prometheus and Grafana
A hands-on guide to collecting Spring Boot application metrics via Micrometer into Prometheus and visualizing them in real-time with a Grafana dashboard. Includes implementation examples for custom metrics (Counter and Gauge) and security considerations for production environments.
-
How to Speed Up Your Application with Spring Boot Cache - Using @Cacheable and @CacheEvict
An implementation guide for reducing DB access and improving response speed using Spring Cache Abstraction. Covers how to use @Cacheable, @CacheEvict, and @CachePut, selecting between Caffeine and Redis, and cache strategies with practical examples.
-
Differences Between Spring Boot Interceptors and Filters: Implementation Patterns for Pre/Post Request Processing
Explains the differences between Filter and HandlerInterceptor when implementing common processing such as request logging and authentication checks in Spring Boot. Illustrates differences in execution timing, Spring management, and accessible information with diagrams, and shows selection criteria by use case—authentication, logging, CORS, exception handling—with practical code examples.
-
Managing Database Migrations with Flyway in Spring Boot - From Version Control to Production
A practical guide to safely managing database schema changes using Flyway in Spring Boot applications. Covers initial setup, creating migration scripts, environment-specific application, and troubleshooting.
-
How to Implement Asynchronous Processing in Spring Boot - Using @Async and @EnableAsync
A practical guide to implementing asynchronous processing with the @Async annotation in Spring Boot. Covers how to run email sending and heavy processing in the background to speed up API responses, thread pool configuration, exception handling, and how to use CompletableFuture.
-
Understanding Spring Boot's Auto-Configuration Mechanism
Explains why Spring Boot works without any configuration, from the perspective of @EnableAutoConfiguration and Condition annotations. A practical deep-dive covering debugging methods and how to create custom AutoConfiguration.
-
How to Use Spring Boot Caching - Easy Performance Improvement with @Cacheable
A practical guide covering the Spring Cache Abstraction mechanism, how to use @Cacheable, @CacheEvict, and @CachePut, and how to switch to Caffeine or Redis — all with working code examples. Aimed at beginner-to-intermediate developers looking to easily reduce response latency caused by redundant calls to databases or external APIs.
-
How to Write Integration Tests in Spring Boot - Testing with @SpringBootTest and Testcontainers Including DB
A guide with code examples on how to write tests that start the entire application with @SpringBootTest, and how to implement integration tests that connect to a real DB on a Docker container using Testcontainers.
-
How to Configure Logging in Spring Boot - Logback and SLF4J Basics and Practical Configuration
A step-by-step guide to Spring Boot logging configuration from basics to practice. Covers changing log levels in application.properties, file output with logback-spring.xml, log rotation, and environment-specific configuration with concrete implementation examples.
-
How to Call REST APIs in Spring Boot - When to Use RestTemplate vs WebClient
A practical guide to the two main approaches for calling external REST APIs in Spring Boot: RestTemplate and WebClient. Covers basic usage, criteria for choosing between them, timeout configuration, and error handling.
-
How to Run a Spring Boot App in a Docker Container - From Dockerfile Creation to Docker Compose Integration
A practical guide covering everything from Dockerfile optimization for Spring Boot apps (multi-stage builds and layer caching) to launching with PostgreSQL via Docker Compose, explaining the full journey from local development to production deployment.
-
How to Implement Stateless Authentication with Spring Security + JWT
A practical guide to integrating JWT authentication into a Spring Boot REST API from scratch. Step-by-step walkthrough covering token generation, validation, JwtAuthenticationFilter implementation, SecurityFilterChain configuration, and verification — with a focus on code.
-
Understanding Transaction Management with @Transactional in Spring Boot - How to Use Propagation Levels and Isolation Levels
A comprehensive guide to transaction management using the @Transactional annotation in Spring Boot, from basics to practical usage. Covers default behavior, all 7 propagation levels, 4 isolation levels, and common failure patterns where rollback does not work (checked exceptions, self-invocation) with real examples.
-
Getting Started with Spring Security Authentication - From Basic Auth to Form Login
A beginner-friendly tutorial for implementing Spring Security authentication step by step. Covers everything from minimal configuration to Basic authentication and form-based login, with careful explanations of common configuration pitfalls.
-
How to Implement Pagination in Spring Boot REST API - Using Pageable and Page
Step-by-step guide to implementing REST API pagination using Spring Data JPA's Pageable and Page. Covers page specification via query parameters, sort conditions, custom response formats, and error handling with practical code examples.
-
Managing Configuration in Spring Boot with application.properties/yml - When to Use @Value vs ConfigurationProperties
A practical guide covering the basics of Spring Boot configuration file syntax, how to choose between @Value and @ConfigurationProperties in real-world projects, and managing settings with environment variables and placeholders.
-
Have You Ever Been Unsure How to Write Spring Data JPA Query Methods?
A step-by-step explanation of Spring Data JPA query method naming conventions and usage (findBy, existsBy, etc.) with practical examples. Covers combining multiple conditions, sorting, pagination, and custom queries using @Query, including common pitfalls for beginners.
-
How to Map Entity Relationships with JPA in Spring Boot - Using @OneToMany and @ManyToOne
A beginner-friendly guide to correctly mapping relationships between entities (@OneToMany, @ManyToOne, @ManyToMany) with JPA in Spring Boot. Covers the differences between bidirectional and unidirectional associations, cascade configuration, choosing FetchType, and practical approaches to avoiding the N+1 problem and circular references.
-
Let's Write Tests in Spring Boot - Introduction to Unit Testing with JUnit and Mockito
A tutorial for those writing test code for Spring Boot applications for the first time. Step-by-step explanation of how to write unit tests for the Controller and Service layers using JUnit and Mockito, with @WebMvcTest and @MockBean.
-
How to Safely Switch Configurations per Environment Using Spring Boot Profiles
Using Spring Boot Profiles, you can switch configurations between development, staging, and production environments. This guide clearly explains how to write separate application.yml files, how to activate profiles, and common pitfalls to avoid.
-
How to Implement Group Validation and Method Validation with Spring Boot @Validated Annotation
A guide to safely integrating group validation and Service layer method validation using Spring Boot's @Validated, covering differences from @Valid and exception handling.
-
How to Simply Implement Validation with Spring Boot @Valid Annotation
A thorough explanation of how to use the @Valid annotation for validating form and API request data in Spring Boot, along with detailed control methods using various constraint annotations.
-
Introduction to Spring @Bean 'Names' - When Should You Set One? How Does It Work? What's the Priority?
When developing with Spring Boot, you often have opportunities to use @Bean. One thing that can be subtly tricky is the question of 'Should I give this @Bean a name, or just leave it alone?' This article organizes, from a practical perspective, what @Bean names are used for, when you should explicitly set one, and even 'which one gets chosen (priority)' when multiple Beans exist.
-
What is @Configuration / @Bean in Spring Boot? A Clear Guide to How to Use Them
Have you ever come across @Configuration or @Bean while developing with Spring Boot? These are points that tend to cause confusion, such as 'What's the difference from @Component?' and 'Where is the correct place to use them?' This article explains the roles and usage of @Configuration/@Bean with concrete examples.
-
Getting Started with Spring Boot Actuator
A beginner-friendly guide to quickly exposing health checks and metrics with Spring Boot Actuator, and building the monitoring foundation needed for operations.
-
How to Return Unified Error Responses in Spring Boot REST API - Using @ControllerAdvice and @ExceptionHandler
Explains how to implement unified JSON error responses for exceptions in Spring Boot REST API. Introduces design patterns and code examples for returning validation errors, business errors, and system errors with appropriate HTTP status codes using @ControllerAdvice and @ExceptionHandler.
-
Using the @Scheduled Annotation in Spring Boot
A beginner-friendly guide to using @Scheduled in Spring Boot with real examples. Covers the differences between fixedRate, fixedDelay, and cron, timezone configuration, and common pitfalls (duplicate execution, exception-caused stops) with solutions.
-
What is @Component in Spring Boot? Differences from @Bean Explained
A beginner-friendly explanation of @Component in Spring Boot. Covers the differences from @Bean, when to use each, the relationship with dependency injection, and common decision points in real-world development, with code examples.
-
What is Spring Boot Starter?
A beginner-friendly explanation of the role and mechanism of Spring Boot Starters. Covers how to choose key Starters like spring-boot-starter-web, why dependency management becomes easier, and common pitfalls to watch out for.
-
What is Spring AOP? Inserting Pre/Post Processing Around Methods with Spring AOP
Spring AOP is a mechanism that lets you write cross-cutting concerns — such as logging and authorization checks — separately from your business logic. This article explains the concepts behind Spring AOP in an easy-to-understand way, and introduces how to set it up in Spring Boot along with basic usage examples.
-
Introduction to Dependency Injection with Spring Boot
A clear overview of DI (Dependency Injection) — from its meaning and benefits to how to write it in Spring Boot — as a first step toward testable design.
-
A Beginner's Guide to Understanding the Difference Between Spring and Spring Boot in 5 Minutes
This guide clearly explains the differences between Spring and Spring Boot from the perspective of 'what becomes easier' and 'what you configure yourself,' helping beginners choose without confusion.
-
Why Is Spring Boot Commonly Used in Business System Development?
Explains why Spring Boot is chosen for business systems from the perspectives of development speed, maintainability, and operability. Covers which projects it suits and which it doesn't, along with pre-adoption checkpoints from a practical standpoint.