LuTiao Programming
Author

LuTiao Programming

LuTiao Programming is a friendly community offering free programming lessons. We inspire learners to explore new ideas and technologies and quickly acquire job-ready skills.

225
Articles
0
Likes
1.1k
Views
0
Comments
Recent Articles

Latest from LuTiao Programming

100 recent articles max
LuTiao Programming
LuTiao Programming
Sep 29, 2026 · Backend Development

Spring Boot Retry Pitfall: Timeout ≠ Failure — Idempotency & Concurrency Fixes

The article explains why naive retries after timeouts cause duplicate orders in Spring Boot, demonstrating how to properly classify retryable exceptions, implement idempotency with stable request IDs, handle non-idempotent third-party APIs via query-before-retry, add concurrency limits with @ConcurrencyLimit, and separate concerns into Service, Gateway, and Client layers using Spring Framework 7's @Retryable.

Backend PatternsConcurrency LimitIdempotency
0 likes · 14 min read
Spring Boot Retry Pitfall: Timeout ≠ Failure — Idempotency & Concurrency Fixes
LuTiao Programming
LuTiao Programming
Sep 28, 2026 · Backend Development

Java Discount Allocation: Solving the 1-Cent Rounding Error in Partial Refunds

The article presents a Java solution for allocating order-level discounts to individual items using integer arithmetic and deterministic remainder distribution, ensuring accurate partial refunds by persisting per-unit prices, allocated discounts, and payable amounts at checkout, with database schema and concurrency considerations.

BigIntegerJavaconcurrency control
0 likes · 12 min read
Java Discount Allocation: Solving the 1-Cent Rounding Error in Partial Refunds
LuTiao Programming
LuTiao Programming
Sep 27, 2026 · Backend Development

Why the 101st Waitlist User Never Gets Skipped: Atomic Promotion with MySQL Row Locks

This article demonstrates how to implement a correct waitlist auto-promotion system for limited-capacity events using Spring Boot, MySQL InnoDB row locks, and database transactions to atomically handle cancellations and promotions without race conditions, ensuring the first waitlisted user always gets the freed spot.

Database TransactionsInnoDBJava 17
0 likes · 12 min read
Why the 101st Waitlist User Never Gets Skipped: Atomic Promotion with MySQL Row Locks
LuTiao Programming
LuTiao Programming
Sep 25, 2026 · Backend Development

How One SQL Statement Solves the Order Closure vs Payment Callback Race

This article demonstrates how to prevent race conditions between order timeout closure and payment callbacks using atomic conditional UPDATE statements and SELECT FOR UPDATE with a refund outbox pattern, ensuring either payment wins and order becomes PAID, or closure wins and late payments trigger automatic refund compensation.

InnoDBMySQLSpring Boot
0 likes · 11 min read
How One SQL Statement Solves the Order Closure vs Payment Callback Race
LuTiao Programming
LuTiao Programming
Sep 24, 2026 · Backend Development

Spring Boot 4.1's InetAddressFilter Finally Blocks SSRF in URL Preview APIs

The article demonstrates how Spring Boot 4.1's new InetAddressFilter.externalAddresses() simplifies SSRF protection for user-supplied URLs, replacing manual IP checks with a centralized HTTP client filter, while also covering URL validation, redirect handling, timeouts, response size limits, and testing strategies to secure link preview and similar features.

Backend DevelopmentInetAddressFilterJava
0 likes · 14 min read
Spring Boot 4.1's InetAddressFilter Finally Blocks SSRF in URL Preview APIs
LuTiao Programming
LuTiao Programming
Sep 23, 2026 · Backend Development

How to Add Passkey Authentication to Spring Boot with Spring Security 7.1

This guide demonstrates integrating Passkey/WebAuthn authentication into a Spring Boot application using Spring Security 7.1's built-in support, covering dependency setup, security configuration, frontend JavaScript implementation for credential registration and authentication, database persistence with JDBC repositories, and a migration strategy that retains password login while adding Passkey as a second factor.

AuthenticationJDBCJava
0 likes · 17 min read
How to Add Passkey Authentication to Spring Boot with Spring Security 7.1
LuTiao Programming
LuTiao Programming
Sep 22, 2026 · Backend Development

Beyond Distributed Locks: Three-Layer Idempotency for Spring Boot Order APIs

The article demonstrates why distributed locks alone fail to guarantee idempotency in Spring Boot order APIs, and presents a three-layer solution combining Idempotency-Key with request fingerprinting, Redis SET NX for fast duplicate interception, and a database unique constraint as the ultimate safeguard against duplicate orders even after crashes or Redis failures.

API DesignDistributed LocksIdempotency
0 likes · 25 min read
Beyond Distributed Locks: Three-Layer Idempotency for Spring Boot Order APIs
LuTiao Programming
LuTiao Programming
Sep 21, 2026 · Backend Development

Distributed Rate Limiting with Redis + Lua: Surviving API Floods in Spring Boot

After an external system hammered a Spring Boot search endpoint causing database connection exhaustion, the author builds a distributed fixed-window rate limiter using Redis and Lua for atomicity, wraps it with an annotation-driven AOP aspect supporting user, IP, API key, and global dimensions, returns proper HTTP 429 with Retry-After, discusses fixed-window limitations versus token bucket and sliding window, and covers fail-open/fail-closed strategies for Redis outages plus monitoring metrics.

AOPFail-OpenFixed Window
0 likes · 17 min read
Distributed Rate Limiting with Redis + Lua: Surviving API Floods in Spring Boot
LuTiao Programming
LuTiao Programming
Sep 20, 2026 · Backend Development

Spring Boot Large File Download: Streaming & Range Requests for Resumable Transfers

The article shows how to handle 10GB file downloads in Spring Boot by replacing in-memory byte[] loading with streaming via FileSystemResource and leveraging Spring MVC's built-in Range request support for resumable downloads, while covering security, immutability, and object storage offloading.

File DownloadFileSystemResourceMemory Optimization
0 likes · 16 min read
Spring Boot Large File Download: Streaming & Range Requests for Resumable Transfers
LuTiao Programming
LuTiao Programming
Sep 20, 2026 · Backend Development

How to Guarantee Single Order Processing When Payment Callbacks Fire 10 Times

The article explains how to handle duplicate payment callbacks in Spring Boot using database unique constraints, conditional state updates, an outbox pattern for reliable event publishing, and downstream idempotency, ensuring orders are processed exactly once even if the payment platform sends repeated notifications.

Database ConstraintsIdempotencyOutbox Pattern
0 likes · 17 min read
How to Guarantee Single Order Processing When Payment Callbacks Fire 10 Times