Agent-skills-standard spring-boot-scheduling
Configure scheduled tasks and distributed locking with ShedLock in Spring Boot. Use when implementing @Scheduled tasks or distributed locking with ShedLock in Spring Boot. (triggers: **/*Scheduler.java, **/*Job.java, scheduled, shedlock, cron)
install
source · Clone the upstream repo
git clone https://github.com/HoangNguyen0403/agent-skills-standard
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/HoangNguyen0403/agent-skills-standard "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/spring-boot/spring-boot-scheduling" ~/.claude/skills/hoangnguyen0403-agent-skills-standard-spring-boot-scheduling && rm -rf "$T"
manifest:
skills/spring-boot/spring-boot-scheduling/SKILL.mdsource content
Spring Boot Scheduling Standards
Priority: P0
Configure Scheduled Tasks
- ThreadPool: ALWAYS configure dedicated
(default 1 thread). Enable withTaskScheduler
annotation.@EnableScheduling - Async: Keep
methods light; offload to@Scheduled
/Queues. Wrap logic in try/catch; log errors and use@Async
for retry on transient failures.@Retryable
Lock Tasks with ShedLock
- Problem:
runs on ALL pods in K8s.@Scheduled - Solution: Use ShedLock to guarantee single execution.
- Config: Set
(deadlock safety) andlockAtMostFor
(debounce).lockAtLeastFor
See implementation examples for ShedLock distributed task configuration and scheduler pool setup.
Anti-Patterns
- No Default Pool: Configure dedicated TaskScheduler (default 1 thread).
- No duplicates: Use ShedLock for distributed cron in multi-pod deployments.
- No task state: Design tasks to idempotent; assume pod can restart.