Redis Articles
Articles covering Redis integration patterns with Spring Boot including caching, session management, and Pub/Sub.
-
How to Implement Session Management with Spring Session + Redis in Spring Boot - Sharing Sessions Across Multiple Instances
An implementation guide to solving the problem of login state being lost when scaling out a Spring Boot app to multiple instances, using Spring Session + Redis. Covers everything end to end: adding dependencies, configuring spring.session.*, cookie design, Spring Security integration, debugging with redis-cli, and verifying behavior across two instances.
-
How to Write Integration Tests with PostgreSQL, Kafka, and Redis Using Spring Boot Testcontainers
A practical guide to writing multi-container integration tests that simultaneously launch PostgreSQL, Kafka, and Redis using Spring Boot 3.1+'s @ServiceConnection, plus speeding up CI with reuse configuration.
-
How to Implement JWT Refresh Tokens with Spring Security
A guide to issuing, rotating, and revoking access tokens and refresh tokens in Spring Boot, including Redis persistence and reuse detection.
-
How to Implement Idempotency (Idempotency-Key) in a Spring Boot REST API - Preventing Double Charges and Double-Clicks
Learn how to implement the Idempotency-Key header pattern in Spring Boot to prevent double charges and duplicate execution caused by double-clicks on payment APIs. Covers implementation code using OncePerRequestFilter and Redis, lock control for concurrent requests, TTL design, and production operation caveats from a practical perspective.
-
How to Use Redis with Spring Boot - Implementation Patterns for Session Management, Caching, and Pub/Sub
Learn how to solve common issues such as sessions not being shared across multiple instances and switching the backend of @Cacheable using Redis. This article covers connection configuration for spring-boot-starter-data-redis, session externalization with Spring Session, RedisCacheManager, and Pub/Sub implementation, with code examples for each use case.
-
How to Use Spring Boot Caching - Easy Performance Improvements with @Cacheable
A hands-on guide covering how Spring Cache Abstraction works, how to use @Cacheable, @CacheEvict, and @CachePut, switching to Caffeine and Redis, and measuring hit rates with Micrometer, all with practical code examples. Aimed at beginner-to-intermediate developers who want to fix response latency caused by redundant DB or external API calls with just a few lines of annotations.