---
title: "DB-Scheduler: A Persistent, Cluster-Friendly Scheduler for Java"
url: https://daily.dev/posts/db-scheduler-a-persistent-cluster-friendly-scheduler-for-java-najdvpqye
source_url: https://feeds.feedblitz.com/~/968126534/0/baeldung
type: article
source: "Baeldung"
published: 2026-08-22T23:25:37.601Z
updated: 2026-08-22T23:26:07.356Z
tags: ["java", "spring-boot"]
reading_time: 8
upvotes: 14
comments: 1
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# DB-Scheduler: A Persistent, Cluster-Friendly Scheduler for Java

**[Baeldung](https://daily.dev/sources/baeldung)** · 8 min read · 14 upvotes · 1 comments

## Summary

A tutorial introduces db-scheduler, a persistent, cluster-aware Java task scheduling library positioned as a simpler alternative to Quartz. It requires Java 17+, a JDBC connection, and a single database table to store and manage tasks. The guide covers setting up the Scheduler instance with configurable polling and heartbeat intervals, and walks through three task types: simple recurring tasks (static schedules), one-time tasks (scheduled dynamically with custom data), and dynamic recurring tasks (registered at runtime but running on a fixed schedule). It also shows how to integrate db-scheduler with Spring Boot using dedicated starter dependencies for Spring Boot 3.x and 4.x, plus configuration via application properties.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://feeds.feedblitz.com/~/968126534/0/baeldung>

## Questions this post answers

### How do I set up db-scheduler with Spring Boot 4 vs Spring Boot 3?

Use different starter artifacts depending on the Spring Boot version: db-scheduler-spring-boot-4-starter for Spring Boot 4.x, and db-scheduler-spring-boot-starter for Spring Boot 3.x. Both are published under the com.github.kagkarlsson group and, once added, automatically create and start a Scheduler bean and register any task beans it discovers, so only the tasks themselves need to be defined.

_daily.dev surfaces practical library integration guides like this for developers wiring up Spring Boot services._

### How does db-scheduler prevent a scheduled job from running twice across multiple service instances in a cluster?

It coordinates cluster instances through a single shared database table where tasks are picked, tracked with heartbeats, and marked with a picked_by owner column. Instances must share consistent heartbeat and missed-heartbeat settings (defaults: heartbeat every 5 minutes, task considered dead after 6 missed heartbeats) so jobs aren't dropped or duplicated across the cluster.

_Developers building reliable distributed job scheduling can track library patterns like this on daily.dev._

### What database table structure does db-scheduler require to persist scheduled tasks?

It requires a single table, typically named scheduled_tasks, with columns including task_name, task_instance, task_data, execution_time, picked, picked_by, last_success, last_failure, consecutive_failures, last_heartbeat, version, and priority, with a composite primary key on task_name and task_instance. DDL scripts are provided for most major RDBMS engines, including PostgreSQL.

_daily.dev helps backend developers keep up with persistence patterns like this when choosing a scheduling library._

---

Tags: [#java](https://daily.dev/tags/java), [#spring-boot](https://daily.dev/tags/spring-boot)

[View this post on daily.dev](https://daily.dev/posts/db-scheduler-a-persistent-cluster-friendly-scheduler-for-java-najdvpqye)
