Skillshub spring-boot-scheduling
Standards for scheduled tasks and distributed locking with ShedLock. 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/ComeOnOliver/skillshub
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ComeOnOliver/skillshub "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/HoangNguyen0403/agent-skills-standard/spring-boot-scheduling" ~/.claude/skills/comeonoliver-skillshub-spring-boot-scheduling && rm -rf "$T"
manifest:
skills/HoangNguyen0403/agent-skills-standard/spring-boot-scheduling/SKILL.mdsource content
Spring Boot Scheduling Standards
Priority: P0
Implementation Guidelines
Scheduled Tasks
- ThreadPool: ALWAYS configure a dedicated
(default is 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
Distributed Locking (ShedLock)
- Problem:
runs on ALL pods in K8s.@Scheduled - Solution: Use ShedLock to guarantee single execution.
- Config: Set
(deadlock safety) andlockAtMostFor
(debounce).lockAtLeastFor
Anti-Patterns
- No Default Pool: Configure dedicated TaskScheduler (default is 1 thread).
- No duplicates: Use ShedLock for distributed cron in multi-pod deployments.
- No task state: Design tasks to be idempotent; assume pod can restart.