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
Feb 20, 2025 · Backend Development

How Spring Boot Handles Cross-Origin Requests

This article explains the fundamentals of CORS, why browsers enforce the same‑origin policy, how Spring Boot detects and processes cross‑origin and preflight requests, and provides a minimal configuration and JavaScript example to resolve CORS issues in a Spring Boot application.

CORSConfigurationCross-Origin
0 likes · 11 min read
How Spring Boot Handles Cross-Origin Requests
Shepherd Advanced Notes
Shepherd Advanced Notes
Feb 5, 2025 · Databases

Elegant Techniques for Group‑Then‑Sort and Top‑Record Retrieval in MySQL & Elasticsearch

The article walks through a common database requirement—grouping rows, sorting within each group, and extracting the first (or top N) records—by preparing sample data, comparing MySQL window functions, subqueries, and JOIN solutions, adding index optimizations, and demonstrating equivalent Elasticsearch aggregations, all backed by concrete performance measurements.

ElasticsearchMySQLPerformance Optimization
0 likes · 11 min read
Elegant Techniques for Group‑Then‑Sort and Top‑Record Retrieval in MySQL & Elasticsearch
Shepherd Advanced Notes
Shepherd Advanced Notes
Jan 13, 2025 · Backend Development

Practical Issues and Solutions for Spring Boot Scheduled Tasks, Plus Implementation Details

The article examines common pitfalls of Spring Boot scheduled tasks—such as missing logs, single‑threaded execution, and distributed conflicts—offers trace‑ID logging via AOP, discusses async handling, outlines multi‑threading and distributed scheduling options, and explains the inner workings of @Scheduled and cron expressions.

AOPCron ExpressionSpring Boot
0 likes · 16 min read
Practical Issues and Solutions for Spring Boot Scheduled Tasks, Plus Implementation Details
Shepherd Advanced Notes
Shepherd Advanced Notes
Dec 17, 2024 · Backend Development

Spring Boot Scheduling: Timer vs ScheduledExecutorService vs @Scheduled

This article compares three single‑node scheduling approaches in Spring Boot—Java's legacy Timer, the modern ScheduledExecutorService, and Spring's @Scheduled annotation—showing their implementations, execution characteristics, thread handling, error behavior, and when to prefer each solution.

@ScheduledJava concurrencyScheduledExecutorService
0 likes · 19 min read
Spring Boot Scheduling: Timer vs ScheduledExecutorService vs @Scheduled
Shepherd Advanced Notes
Shepherd Advanced Notes
Nov 18, 2024 · Fundamentals

Why Java’s Ternary Operator Can Throw NPE: Autoboxing Pitfalls Explained

The article explains how Java’s ternary operator can cause NullPointerException when type inference leads to automatic unboxing of a null wrapper, demonstrates this with concrete code examples, decompiled bytecode, and offers strategies such as using consistent types or replacing the ternary with if‑else.

AutoboxingJavaNullPointerException
0 likes · 11 min read
Why Java’s Ternary Operator Can Throw NPE: Autoboxing Pitfalls Explained