Shepherd Advanced Notes
Author

Shepherd Advanced Notes

Dedicated to sharing advanced Java technical insights, daily work snippets, and the power of persistent effort.

127
Articles
0
Likes
403
Views
0
Comments
Recent Articles

Latest from Shepherd Advanced Notes

100 recent articles max
Shepherd Advanced Notes
Shepherd Advanced Notes
Aug 21, 2023 · Backend Development

High‑Availability Rate‑Limiting Solutions for Spring Boot Systems

The article explains why rate limiting is essential for high‑traffic Spring Boot services, compares counter, sliding‑window, token‑bucket and leaky‑bucket algorithms, demonstrates implementations with plain Java, Guava RateLimiter, AOP, and distributed approaches using Redis‑Lua and Nginx‑Lua, and provides practical configuration examples.

GuavaNginxRate Limiting
0 likes · 20 min read
High‑Availability Rate‑Limiting Solutions for Spring Boot Systems
Shepherd Advanced Notes
Shepherd Advanced Notes
Aug 14, 2023 · Backend Development

Common @Transactional Pitfalls in Spring Boot Business Code and How to Avoid Them

This article analyzes frequent scenarios where Spring's @Transactional annotation fails in Spring Boot projects—such as self-invocation, swallowed exceptions, misconfigured rollback rules, non‑public methods, wrong propagation settings, and long‑running transactions—and provides concrete fixes to prevent data inconsistency and performance issues.

@TransactionalCGLIB proxySpring Boot
0 likes · 17 min read
Common @Transactional Pitfalls in Spring Boot Business Code and How to Avoid Them
Shepherd Advanced Notes
Shepherd Advanced Notes
Aug 7, 2023 · Backend Development

Implementing Multilevel Cache in Spring Boot with Redis and Caffeine

This article explains how to build a three‑layer cache architecture for Spring Boot by integrating Redis as a distributed cache with Caffeine as a local cache, covering configuration, custom CacheManager implementation, message‑driven synchronization, and practical usage examples.

CaffeineSpring Cachecache
0 likes · 15 min read
Implementing Multilevel Cache in Spring Boot with Redis and Caffeine
Shepherd Advanced Notes
Shepherd Advanced Notes
Jul 31, 2023 · Backend Development

How Spring Uses AOP to Implement Transaction Management

This article explains why transaction control is essential for database‑backed applications, compares native JDBC/MyBatis handling with Spring's unified approach, details the core transaction APIs, and walks through the AOP‑based mechanism—including @EnableTransactionManagement, proxy generation, and CGLIB interception—that automatically opens, commits, and rolls back transactions at runtime.

@TransactionalAOPBackend Development
0 likes · 20 min read
How Spring Uses AOP to Implement Transaction Management
Shepherd Advanced Notes
Shepherd Advanced Notes
Jul 24, 2023 · Backend Development

Understanding the Core Principles of Spring AOP Aspect Programming

This article explains how Spring AOP integrates AspectJ using CGLIB or JDK dynamic proxies, walks through a complete logging aspect example, and details the internal registration, proxy creation, and invocation processes that enable cross‑cutting concerns without modifying business code.

AOPAspectJCGLIB
0 likes · 15 min read
Understanding the Core Principles of Spring AOP Aspect Programming
Shepherd Advanced Notes
Shepherd Advanced Notes
Jul 17, 2023 · Fundamentals

How to Pass Values Between Parent and Child Threads with InheritableThreadLocal and TransmittableThreadLocal

The article explains why regular ThreadLocal cannot share data from a parent thread to its child, introduces InheritableThreadLocal as a built‑in solution, shows its limitation with thread‑pool reuse, and demonstrates how Alibaba's TransmittableThreadLocal overcomes this issue with concrete code examples and output.

ConcurrencyInheritableThreadLocalJava
0 likes · 10 min read
How to Pass Values Between Parent and Child Threads with InheritableThreadLocal and TransmittableThreadLocal
Shepherd Advanced Notes
Shepherd Advanced Notes
Jul 4, 2023 · Backend Development

Implement Distributed Log Tracing in Spring Boot with MDC and traceId

This guide explains how to add a unique traceId to each request in a Spring Boot application, configure Logback/MDC to record it, propagate the ID across microservice calls and asynchronous threads using OpenFeign, RestTemplate, and TransmittableThreadLocal, enabling complete distributed log tracing.

LogbackMDCOpenFeign
0 likes · 18 min read
Implement Distributed Log Tracing in Spring Boot with MDC and traceId
Shepherd Advanced Notes
Shepherd Advanced Notes
Jun 27, 2023 · Backend Development

Implementing Distributed Locks in Spring Boot with Redisson

This article explains how Redisson extends Redis to provide a rich set of distributed Java objects and services, walks through integrating Redisson into a Spring Boot project, demonstrates various lock types (reentrant, read‑write, semaphore, latch) with code examples, and details the internal watchdog mechanism that guarantees atomic lock acquisition and automatic renewal.

Distributed LockJavaRedis
0 likes · 19 min read
Implementing Distributed Locks in Spring Boot with Redisson
Shepherd Advanced Notes
Shepherd Advanced Notes
Jun 19, 2023 · Backend Development

Elegant Unified Response and Global Exception Handling in Spring Boot

The article explains how Spring Boot projects can adopt a standard JSON response structure using a generic ResponseVO class and achieve automatic wrapping and global exception handling through a custom @ResponseResultBody annotation combined with ResponseBodyAdvice and @ControllerAdvice, reducing repetitive code and improving robustness.

Global Exception HandlingResponseBodyAdviceResponseVO
0 likes · 14 min read
Elegant Unified Response and Global Exception Handling in Spring Boot