인터페이스는 현지화되어 있으며, Skill 소개와 설명 문서는 선택한 언어로 AI가 자동 번역합니다. 코드·명령어·경로·전문 용어는 원문을 유지하며 원작자 문서가 우선합니다.
Skills 둘러보기
생산성 및 협업 · SKILL.md

spring-boot-scheduling

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.

Independent GitHub snapshot · Automated classification · Original documentation governs

Skill 문서

GitHub

name: spring-boot-scheduling description: Configure scheduled tasks and distributed locking with ShedLock in Spring Boot. Use when implementing @Scheduled tasks or distributed locking with ShedLock in Spring Boot. metadata: triggers: files: - '/*Scheduler.java' - '/*Job.java' keywords: - scheduled - shedlock - cron

Spring Boot Scheduling Standards

Priority: P0 (CRITICAL)

Configure Scheduled Tasks

  • ThreadPool: ALWAYS configure dedicated TaskScheduler (default 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.

Lock Tasks with ShedLock

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

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.

References

저장한 Skills