Skip to content
Back to skills

Spring Boot Scheduling

ASecurity

Configure scheduled tasks and distributed locking with ShedLock in Spring Boot. Use when implementing @Scheduled tasks or distributed locking with ShedLock in Spring Boot.

  • 549 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 6, 2026
developmentjavaspring

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned June 6, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill spring-boot-scheduling --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Spring Boot Scheduling?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Spring Boot Scheduling
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-spring-boot-scheduling/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-spring-boot-scheduling)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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**

## 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](references/implementation.md) 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

- [Implementation Examples](references/implementation.md)

Files in this skill

  • SKILL.md1.4 KB
  • evals/evals.json1.8 KB
  • references/implementation.md1.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.