#Spring Boot
34 posts
-
CloudFront CDN in Practice (2) — Putting a Spring Boot + Kotlin Origin Behind CloudFront (Terraform)
Put a Spring Boot + Kotlin app as the origin and CloudFront in front. Set Cache-Control/ETag in Kotlin, split /api/* (no cache) and /static/* (cached) behaviors, build it in Terraform, verify hit/miss via X-Cache, and run an invalidation
-
Spring Batch 6 Guide Capstone: Marketplace Analytics Pipeline — ETL · KPI Aggregation · K8s CronJob
The capstone that gathers Spring Batch 6 series Parts 1–6 into one pipeline, on Spring Boot 4 + Kotlin 2.3 + PostgreSQL 16. A daily-etl that moves yesterday's orders from the operational marketplace schema to the analytics schema, plus daily-kpi and monthly-kpi that aggregate on top — all on one PostgreSQL 16 instance split by two datasources. Partition the ETL (Part 5), keep re-runs safe with idempotent upsert (Part 3), and operate it with observability and K8s CronJob (Part 6) — written in idiomatic Kotlin without Lombok. Series capstone.
-
Spring Batch 6 Guide Part 6: Observability · Testing · Deployment — Micrometer · @SpringBatchTest · Testcontainers · K8s CronJob
How to observe, test, and deploy Spring Batch 6 jobs on Spring Boot 4 + Kotlin 2.3 + PostgreSQL 16. The six auto-registered Micrometer metrics and Prometheus exposure, structured logging that stamps jobName/stepName/chunkIndex onto every log line via MDC, the test pyramid / four annotations / five test doubles recapped self-contained in batch context, verifying slices, full jobs, and restart with @SpringBatchTest and JobLauncherTestUtils, why you test against Testcontainers PostgreSQL 16 instead of H2, and a Java 21 multi-stage Dockerfile plus a K8s CronJob — written in idiomatic Kotlin without Lombok. Series Part 6.
-
Spring Batch 6 Guide Part 5: Performance · Parallelism — Multi-thread · Partitioning · Remote Workers · Virtual Threads
How to run Spring Batch 6 jobs faster on Spring Boot 4 + Kotlin 2.3 + PostgreSQL 16. The Reader-concurrency and restart traps when moving from single- to multi-threaded Steps, partitioning that splits data by key range so each partition gets an independent StepExecution, the difference between remote partitioning and remote chunking, where JDK 21 virtual threads shine for IO-bound jobs and the connection-pool ceiling, and a one-million-row benchmark comparing the four approaches — written in idiomatic Kotlin without Lombok. Series Part 5.
-
Spring Batch 6 Guide Part 4: Job Launch · Scheduling · Operations — Triggers · Idempotent Parameters · Data Sources
How to run and operate Spring Batch 6 jobs on Spring Boot 4 + Kotlin 2.3 + PostgreSQL 16. The division of labor between JobLauncher and JobOperator, a decision tree for triggering with @Scheduled / Quartz / K8s CronJob / Argo, JobParameters idempotency-key design and the incrementer trade-off, controlling restart of failed jobs, Actuator/Micrometer-based operational monitoring, stopping the same job from running twice across multiple instances, and the five patterns for where a batch reads its data (same DB · API · Read Replica · analytics Warehouse · CDC) — written in idiomatic Kotlin without Lombok. Series Part 4.
-
Spring Batch 6 Guide Part 3: Transactions · Failure Handling — Skip · Retry · Restart
Transactions and failure handling in Spring Batch 6 on Spring Boot 4 + Kotlin 2.3 + PostgreSQL 16. What rolls back and what survives when one item fails inside a chunk, how to design the fault-tolerant Step's Skip · Retry · NoRollback policies by exception meaning, the item-by-item re-processing (scan) trap that Skip introduces, a catalog of the six listeners, how ExecutionContext preserves the restart position, and finally JobParameters idempotency keys plus PostgreSQL upsert — written in idiomatic Kotlin DSL without Lombok. Series Part 3.
-
Spring Batch 6 Guide Part 2: Chunk-Oriented Processing — Reader · Processor · Writer
Chunk-oriented processing in Spring Batch 6 on Spring Boot 4 + Kotlin 2.3 + PostgreSQL 16. From the read N → process N → write N → commit cycle as the transaction boundary, through the six ItemReader implementations and how to choose, ItemProcessor patterns for transform/filter/composite, JpaItemWriter vs JdbcBatchItemWriter trade-offs, the PostgreSQL ON CONFLICT idempotency pattern, and the most-confused topic — chunk size vs page size — written in idiomatic Kotlin DSL without Lombok. Series Part 2.
-
Spring Batch 6 Guide Part 1: Job · Step · Metadata Identity — Spring Boot 4 · Kotlin 2.3
Spring Batch 6 entry-level on Spring Boot 4 + Kotlin 2.3 + PostgreSQL 16. Defining the vocabulary (Job, Step, JobInstance, JobExecution), the six JobRepository metadata tables, your first Hello Tasklet, and the 5.x → 6.x migration essentials (Jakarta EE 10, Java 17 baseline, @EnableBatchProcessing auto-activation) — written in idiomatic Kotlin DSL without Lombok. Series Part 1.
-
7 Practical java.util.concurrent Patterns: From Thread Pools to Concurrency Control
ExecutorService, CompletableFuture, CountDownLatch, ConcurrentHashMap, BlockingQueue, Semaphore, ReentrantLock — 7 commonly used java.util.concurrent classes with real-world patterns and working code.
-
FCFS Load Test Retrospective: Things Easy to Miss in Practice
Problems we hit while k6-testing 4 FCFS strategies — Rate Limiter conflicts, queue over-counting bugs. Plus 4 ways to isolate FCFS APIs from regular APIs in production: separate DataSource, Redis offloading, service separation, and Bulkhead pattern.
-
Implementing FCFS with Tokens: From Entry Tickets to Bot Prevention
Implements a first-come-first-served system that issues entry tokens upfront — only token holders can purchase. Covers JWT-based token design, TTL expiration strategy, and multi-layered bot prevention with Rate Limiting + CAPTCHA.
-
Implementing FCFS with Redis: From DECR to Lua Scripts
Implements a first-come-first-served stock deduction system using Redis DECR atomic operations and Lua scripts. Builds it with Spring Boot + Redisson, directly compares TPS against DB locks under identical conditions (100 stock, 100 concurrent users), and covers Redis-DB consistency and failure recovery strategies.
-
Implementing FCFS with DB Locks: From FOR UPDATE to Concurrency Testing
Implements a first-come-first-served stock deduction system using SELECT FOR UPDATE. Builds it with Spring Boot + JPA, validates data consistency with 100 concurrent requests, and identifies where DB locks hit their limits.
-
Deadlocks and Lock Strategies by Isolation Level: From Pessimistic Locks to FOR UPDATE's Limits
Real deadlock cases at each isolation level — Read Committed, Repeatable Read, and Serializable. Covers pessimistic vs optimistic locking, FOR UPDATE mechanics, and why you'll eventually need Redis.
-
A Practical Guide to HTTP Custom Headers in Production
A comprehensive guide to commonly used HTTP custom headers like X-Request-ID and X-Forwarded-For. Covers the history of the X- prefix convention, CORS implications, and Spring Boot implementation.
-
Understanding CORS: From Browser Security Policy to Spring Boot Configuration
Understand how CORS (Cross-Origin Resource Sharing) works and learn how to resolve common CORS errors in practice
-
SAML 2.0 Authentication Complete Guide: From Concepts to Microsoft Entra ID Integration
A practical guide to SAML 2.0 protocol core concepts and implementing Microsoft Entra ID (Azure AD) SAML integration with Spring Boot
-
Setting Up a Local K8s Cluster with kind
A hands-on guide to building a multi-node Kubernetes cluster locally using kind and deploying a Spring Boot application
-
Spring Boot SSO Integration Guide: OAuth2/OIDC and SAML in Practice
A practical guide to SSO integration with IdPs like Keycloak, Okta, and Azure AD using Spring Security
-
Spring Boot Practical Guide Part 7: Logging Strategy and Practice
From SLF4J, Logback, Log4j2 comparison to structured logging, MDC, and centralized log management
-
Spring Boot Practical Guide Part 6: Monitoring and Observability
Real-time system monitoring with Prometheus, Grafana, and custom metrics
-
Spring Boot Practical Guide Part 5: Database Optimization
Handling large-scale data with index design, cursor-based pagination, and Read Replicas
-
Spring Boot Practical Guide Part 4: Resilience Patterns
Building fault-tolerant systems with Circuit Breaker, Rate Limiter, and Bulkhead
-
Spring Boot Practical Guide Part 3: Event-Driven Architecture
Building a reliable event system with Kafka and the Outbox pattern
-
Spring Boot Practical Guide Part 2: Caching Strategy and Redis
A complete caching guide from Cache-Aside pattern to cache problem resolution, ready to apply in production
-
Spring Boot Practical Guide Part 1: Concurrency Control and Inventory Management
A practical guide to solving concurrency issues with atomic UPDATEs and idempotency keys
-
Spring Boot Pre-Interview Guide Comprehensive Assignment: Marketplace REST API — Spring Boot 4 · Kotlin 2.3
On Spring Boot 4 with Kotlin 2.3, a hands-on assignment that lands every pattern from Parts 1–7 in a single project. Build a marketplace REST API in seven days covering member/product/order domains, JWT auth, file uploads, search and pagination, caching, async notifications, and Docker deployment. Pick a single-module or multi-module structure (Option A strict DIP or Option B simplified), targeting 70 base points + 35 bonus — written in Kotlin with primary constructors and val/var, no Lombok.
-
Spring Boot Pre-Interview Guide Part 7: Advanced Patterns — Spring Boot 4 · Kotlin 2.3 · Events · Async · Multi-module
On Spring Boot 4 with Kotlin 2.3, the patterns that make your assignment stand out. Domain-and-side-effect separation via @TransactionalEventListener, async fan-out with @Async + CompletableFuture, file upload validation, URI versioning, layered vs Hexagonal vs CQRS, and multi-module Option A (DIP) vs Option B (pragmatic) — written without Lombok, using Kotlin primary constructors and val/var.
-
Spring Boot Pre-Interview Guide Part 6: DevOps & Deployment — Spring Boot 4 · Kotlin 2.3 · Docker · GitHub Actions
On Spring Boot 4 with Kotlin 2.3, this part covers what reviewers actually look at in the deployment layer: a Java 21 multi-stage Dockerfile, docker-compose with healthcheck + depends_on for real readiness, GitHub Actions with Gradle cache and JaCoCo coverage, profile-separated application.yml, and Actuator exposing health and prometheus — written without Lombok, using Kotlin primary constructors and val/var.
-
Spring Boot Pre-Interview Guide Part 5: Security & Authentication — Spring Boot 4 · Kotlin 2.3 · Spring Security 7, JWT (oauth2-resource-server), BCrypt vs Argon2, RBAC
On Spring Boot 4 with Kotlin 2.3, how to implement standard JWT authentication using Spring Security 7 and spring-boot-starter-oauth2-resource-server — JwtDecoder/JwtEncoder bean pair for verify and issue, JwtAuthenticationConverter mapping the role claim to ROLE_ authorities, @AuthenticationPrincipal Jwt for extracting the current user in controllers, picking between BCrypt and Argon2, @PreAuthorize plus service-layer resource ownership checks, and the common CORS traps — written from an evaluator's perspective on the security pieces of pre-interview assignments.
-
Spring Boot Pre-Interview Guide Part 4: Performance & Optimization — Spring Boot 4 · Kotlin 2.3 N+1, Pagination, Caching, QueryDSL
On Spring Boot 4 with Kotlin 2.3, learn the trade-offs between the three N+1 solutions (Fetch Join, @EntityGraph, @BatchSize), when to choose Page vs Slice vs Cursor, how to decide between Caffeine and Redis, and when QueryDSL and Projection actually earn their keep — the performance optimization checkpoints that separate passing assignments from standout ones, from an evaluator's perspective.
-
Spring Boot Pre-Interview Guide Part 3: Documentation & AOP — Spring Boot 4 · Kotlin 2.3 Swagger, MDC, Aspect Operations
On a Spring Boot 4 + Kotlin 2.3 stack — SpringDoc/Swagger conventions, MDC-based request tracing with sensitive-data masking, and separating cross-cutting concerns with AOP. The Documentation, Logging, and AOP areas that decide pre-interview score swings, written from an evaluator's perspective. Series Part 3.
-
Spring Boot Pre-Interview Guide Part 2: Database & Testing — Spring Boot 4 · Kotlin Environment Separation, Test Pyramid, Testcontainers
On a Spring Boot 4 + Kotlin stack — picking the right DB per environment, the ddl-auto policy, gotchas when implementing a Memory Repository, choosing annotations along the Test Pyramid, when to reach for Dummy/Stub/Spy/Mock/Fake, and using Testcontainers to surface the bugs H2's dialect differences hide. Written with data classes and val/var instead of Lombok. Series Part 2.
-
Spring Boot Pre-Interview Guide Part 1: Core Application Layer — Spring Boot 4 · Kotlin Four-Layer Design
The four-layer design points evaluators repeatedly flag in Spring Boot pre-interview assignments — Controller/Service/Repository/Domain responsibility split, Request → Command conversion, what @Transactional(readOnly=true) actually does, and the three-tier priority of GlobalExceptionHandler — written for a Spring Boot 4 + Kotlin stack where data classes, primary constructors, and val/var replace Lombok naturally. Series Part 1.