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.md
source content

Spring Boot Scheduling Standards

Priority: P0

Implementation Guidelines

Scheduled Tasks

  • ThreadPool: ALWAYS configure a dedicated
    TaskScheduler
    (default is 1 thread). Enable with
    @EnableScheduling
    annotation.
  • Async: Keep
    @Scheduled
    methods light; offload to
    @Async
    /Queues. Wrap logic in try/catch; log errors and use
    @Retryable
    for retry on transient failures.

Distributed Locking (ShedLock)

  • Problem:
    @Scheduled
    runs on ALL pods in K8s.
  • Solution: Use ShedLock to guarantee single execution.
  • Config: Set
    lockAtMostFor
    (deadlock safety) and
    lockAtLeastFor
    (debounce).

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.

References